Skip to content

Anthropic provider: structured-output schema rejected (minimum/maximum on integer/number) #76

Closed

Description

@repowazdogz-droid

Summary
In v2.1.4, the Anthropic provider fails on every LLM-mode scan: the structured-output
schema it sends includes minimum/maximum, which the Anthropic structured-output API
rejects.

Environment
SkillSpector 2.1.4 (from source, main) · Python 3.13 · SKILLSPECTOR_PROVIDER=anthropic ·
LLM mode (i.e. not --no-llm).

What happens
The semantic analyzers fail with two successive HTTP 400s from the Anthropic API — it
rejects minimum/maximum, once on an integer field and once on a number field.

Root cause
The output models declare start_line: int = Field(ge=1) and
confidence: float = Field(ge=0, le=1). Pydantic serializes these to JSON-Schema
minimum/maximum, and Anthropic's structured-output endpoint does not accept those
keywords on integer/number types.

Repro
Run skillspector scan <path> in LLM mode with SKILLSPECTOR_PROVIDER=anthropic and a
valid ANTHROPIC_API_KEY (no --no-llm). → two 400s, analyzers fail. Static --no-llm
mode is unaffected.

Suggested fix
Keep the Pydantic constraints (they're valid validation) and sanitize the schema sent to
Anthropic — strip minimum/maximum from the structured-output schema in the Anthropic
provider. (Confirmed locally that removing the constraints unblocks all three semantic
analyzers; schema-sanitization is the correct upstream form that preserves validation.)

Activity

  1. Varrennyyam commented on Jun 15, 2026

    @Varrennyyam

    Great find! I’m currently diving into security automation and analyzing how different LLM providers handle schema validation. It’s insightful to see how these edge cases are being addressed in SkillSpector. Keep up the excellent work! 🙂

  2. added a commit that references this issue on Jun 16, 2026
  3. keshprad commented on Jun 16, 2026

    @keshprad
    Contributor

    Closing as resolved by #85, which adds native Anthropic provider support and resolves the structured-output tool schema failures caused by unsupported minimum/maximum parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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