Skip to content

[Bug]: GPD Verification Fails with "Invalid value at 'tools0.function_declarations40...enum0' (TYPE_STRING), 1" Error #239

Description

@GraveEaterMadison

Description

Users are encountering an "Invalid value" error when gpd verification is enabled. The specific error message is:
Invalid value at 'tools[0].function_declarations[40].parameters.properties[0].value.properties[1].value.properties[0].value.enum[0]' (TYPE_STRING), 1

Steps to Reproduce

  1. Enable gpd verification in opencode.

  2. Perform an action that triggers GPD verification (exact action unknown, but typically involves code modifications, phase transitions, or specific GPD commands).

  3. Observe the "Invalid value" error.

Expected Behavior

GPD verification should complete without type validation errors, correctly handling all parameter types, including enum values within the lock parameter of gpd-conventions_assert_convention_validate.

But The system throws an "Invalid value" error, specifically (TYPE_STRING), 1, indicating a type mismatch during schema validation, possibly with an enum field expecting a string but receiving an integer.

Runtime

opencode, specifically using the gemini-2.5-flash model (model ID: google/gemini-2.5-flash) but I am facing it with many ai models

Root cause found in src/gpd/mcp/servers/verification_server.py**

The const keyword (JSON Schema draft-6) is not supported by Gemini's OpenAPI 3.0 schema format. Three occurrences:

  1. "must_surface": {"const": True} in the reference input schema — fix: "must_surface": {"enum": [True]}

  2. "schema_version": {"type": "integer", "const": 1} in _CONTRACT_PAYLOAD_INPUT_SCHEMA — fix: "schema_version": {"type": "integer", "enum": [1]}

  3. Same line in _compact_contract_payload_requirement_schema — same fix.

These schemas are used by the run_contract_check and suggest_contract_checks MCP tools in the verification server. When Gemini serializes them, const: 1 gets converted to enum: [1] but the type coercion breaks — the field becomes string-typed while the value 1 remains an integer, producing the (TYPE_STRING), 1 error.

Also latent: src/gpd/contracts.py has schema_version: Literal[1] = 1 in a Pydantic model (Pydantic generates const from Literal). Fix: schema_version: int = Field(default=1, json_schema_extra={"enum": [1]}).

GPD Version

gpd 1.2.2

Operating System

Arch Linux

Screenshots

Image Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions