Skip to content

Image caption generation fails #663

@rafaldabrowskipagepro

Description

@rafaldabrowskipagepro

Describe the bug

I've recently installed the AI assist package in order to be able to auto-generate the alt text on images. It worked once, but the next day when I tried to generate the alt text on another image I got two different errors

This is the error I'm getting on draft documents (doesn't matter if there's a published version or not):

Image

This is the one I'm getting on published documents:

Image

The assist package has been added to the plugins list with no additional configuration - assist()

Here's the image schema

export default defineType({
  name: "customImage",
  type: "image",
  fields: [
    defineField({
      title: "Caption",
      name: "caption",
      type: "string"
    }),
    defineField({
      title: "Alternative text",
      name: "alt",
      type: "string",
    })
  ],
  options: {
    metadata: ["lqip"],
    aiAssist: {
      imageDescriptionField: "alt"
    }
  },
  preview: {
    select: {
      subtitle: "alt",
      media: "asset"
    },
    prepare: ({ subtitle = "", media }) => ({
      title: "Image",
      subtitle,
      media
    })
  }
})

To Reproduce

Steps to reproduce the behavior:

  1. Go to an image in a studio
  2. Click on 'Generate image description'
  3. See error

Expected behavior

The image caption is generated without errors

Which versions of Sanity are you using?

@sanity/cli (global) 4.3.0 (latest: 4.10.2)
@sanity/assist 5.0.0 (up to date)
@sanity/block-tools 3.70.0 (up to date)
@sanity/dashboard 4.1.4 (latest: 5.0.0)
@sanity/document-internationalization 1.1.2 (latest: 4.0.0)
@sanity/eslint-config-studio 5.0.2 (up to date)
@sanity/icons 3.7.4 (up to date)
@sanity/image-url 1.2.0 (up to date)
@sanity/types 4.3.0 (latest: 4.10.2)
@sanity/ui 3.1.0 (latest: 3.1.8)
@sanity/vision 4.8.1 (latest: 4.10.2)
sanity 4.3.0 (latest: 4.10.2)

What operating system are you using?

Mac OS 15.5 (24F74)

Which versions of Node.js / npm are you running?

Node v22.19.0

  • Can I access something that's not mine, or something I shouldn't have access to?
  • Can I disable something for other people? If the answer to either of those two questions are "yes", then you're probably dealing with a security issue. Note that even if you answer "no" to both questions, you may still be dealing with a security issue, so if you're unsure, just email us at [security@sanity.io](mailto:security@sanity.io.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions