Skip to content

[BUG] Anthropic API 400 Error: Invalid input (expected string, received array) in messages content #1

@Borye

Description

@Borye

Description:
I encountered a 400 Bad Request error when running codeany. It seems to be a schema validation failure in the Anthropic Messages API request, specifically regarding the content field in the message history.

Error Log:

{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "Invalid Anthropic Messages API request"
  },
  "metadata": {
    "raw": [
      {
        "code": "invalid_union",
        "path": ["messages", 1, "content"],
        "message": "Invalid input: expected string, received array"
      }
    ]
  }
}

Environment:

export CODEANY_API_KEY="sk-or-v1-..."
export CODEANY_BASE_URL="https://openrouter.ai/api"
export CODEANY_MODEL="moonshotai/kimi-k2.5"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions