Skip to content

Anthropic client passes bare model name to modelcaps.Load, causing image attachments to be dropped #2737

@simonferquel-clanker

Description

@simonferquel-clanker

Bug

convertDocument in pkg/model/provider/anthropic/client.go passes c.ModelConfig.Model (e.g. claude-sonnet-4-6) to modelcaps.Load, but Load requires a fully-qualified provider/model identifier (e.g. anthropic/claude-sonnet-4-6).

Root cause

modelcaps.Load does:

parts := strings.SplitN(id, "/", 2)
if len(parts) != 2 {
    return nil, fmt.Errorf("invalid model ID: %q", id)
}

When the bare model name (no /) is passed, it returns an error and falls back to ModelCapabilities{modelFound: false}, which means Supports("image/png") == false.

Effect

Every image and PDF document attachment is silently dropped with:

level=WARN msg="attachment dropped" reason="model does not support MIME type \"image/png\""

...even for models like claude-sonnet-4-6 that fully support images.

Location

pkg/model/provider/anthropic/client.go line where convertDocument is called:

docBlocks, err := convertDocument(ctx, *part.Document, c.ModelConfig.Model)

Should be:

docBlocks, err := convertDocument(ctx, *part.Document, c.ModelConfig.Provider+"/"+c.ModelConfig.Model)

The same issue likely affects the OpenAI/oaistream provider if it also calls convertDocument with a bare model name.

Notes

  • The teamloader correctly uses modelCfg.Provider+"/"+modelCfg.Model when calling modelsStore.GetModel — the Anthropic client should follow the same pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/providers/anthropicFor features/issues/fixes related to the usage of Anthropic modelspriority:highMajor impact, should be addressed within 2 days

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions