Skip to content

create_iteration_field and add_iteration fail with GraphQL input-type errors #21

Description

@joaodotwork

Summary

Both iteration-creation tools fail against the live GitHub GraphQL API. The underlying updateProjectV2Field mutation works fine when called directly — the server appears to be sending the iteration list under a wrong/nonexistent input-type name.

Repro

Called create_iteration_field against a fresh ProjectsV2:

{
  "projectId": "PVT_kwHOAwJiCM4BUd_L",
  "fieldName": "Sprint",
  "duration": 1,
  "startDate": "2026-04-13",
  "iterations": [
    { "title": "M1 — Foundations",          "startDate": "2026-04-13", "duration": 1 },
    { "title": "M2 — Learned SR backbone",  "startDate": "2026-04-14", "duration": 1 },
    { "title": "M3 — Production features",  "startDate": "2026-04-15", "duration": 1 },
    { "title": "M4 — Polish & v0.1.0",      "startDate": "2026-04-16", "duration": 1 }
  ]
}

Error

ProjectV2IterationFieldConfigurationIterationInput isn't a defined input type (on $iterations)

Side effect: the iteration field itself was still created (empty). A follow-up create_iteration_field with the same fieldName then fails with Name has already been taken.

Calling add_iteration on the empty field also fails:

Field 'startDate' doesn't exist on type 'ProjectV2IterationFieldConfiguration'

What works

Direct GraphQL via gh api graphql succeeds with this shape:

mutation {
  updateProjectV2Field(input: {
    fieldId: "PVTIF_…",
    iterationConfiguration: {
      startDate: "2026-04-13",
      duration: 1,
      iterations: [
        { title: "M1 — Foundations",         startDate: "2026-04-13", duration: 1 },
        { title: "M2 — Learned SR backbone", startDate: "2026-04-14", duration: 1 }
      ]
    }
  }) {
    projectV2Field {
      ... on ProjectV2IterationField {
        id
        configuration { iterations { id title startDate duration } }
      }
    }
  }
}

Returns ProjectV2IterationField with populated configuration.iterations (ids, titles, dates).

Schema notes

Introspection confirms:

  • UpdateProjectV2FieldInput.iterationConfiguration → ProjectV2IterationFieldConfigurationInput (non-deprecated, public).
  • ProjectV2IterationFieldConfigurationInput has three non-null fields: startDate: Date!, duration: Int!, iterations: [<unknown>]!.
  • The list element type is not publicly named — searching the schema for any *Iteration*Input returns nothing. In practice GitHub accepts literal objects with { title, startDate, duration } keys.

So the root cause looks like the server is typing iterations against a named input type (ProjectV2IterationFieldConfigurationIterationInput) that doesn't exist in the public schema. Passing the list as an unnamed [JSON!]! / inline-object list (as the working mutation above does) should fix both tools.

Suggested fix

  1. In create_iteration_field and add_iteration, stop referencing ProjectV2IterationFieldConfigurationIterationInput in the GraphQL variable declarations — inline the iterations list or type it as [ProjectV2IterationFieldConfigurationIterationInput!]! only if/when GitHub exposes it.
  2. add_iteration additionally references startDate on the output type ProjectV2IterationFieldConfiguration, which doesn't exist there — that field lives on the individual iterations nodes. Adjust the selection set accordingly.
  3. On create_iteration_field failure, consider rolling back the partially-created field so retries with the same name don't 409.

Environment

  • Tool version: whatever is currently deployed on the MCP server as of 2026-04-13
  • Client: Claude Code via MCP
  • Target: public github.com GraphQL API

Happy to PR if helpful.

Activity

  1. added a commit that references this issue on Aug 14, 2026
    4517036
  2. joaodotwork commented on Aug 14, 2026

    @joaodotwork
    OwnerAuthor

    Fixed — the input-type error in #26, the empty-field side effect in #27.

    The error. ProjectV2IterationFieldConfigurationIterationInput was never a real type; the tool invented it. The iterations argument is now declared [ProjectV2Iteration!]!, matching the mutation you showed working via gh api graphql. Live introspection confirms:

    ProjectV2IterationFieldConfigurationInput { startDate: Date!, duration: Int!, iterations: [ProjectV2Iteration!]! }
    ProjectV2Iteration (INPUT_OBJECT)         { startDate, duration, title }
    

    add_iteration's separate failure — Field 'startDate' doesn't exist on type 'ProjectV2IterationFieldConfiguration' — came from the same family of mistake in the other direction: the output type has only completedIterations, duration, iterations, startDay. It now reads startDay and derives the input startDate from the earliest iteration.

    The side effect you flagged — "the iteration field itself was still created (empty)", and the retry failing with Name has already been taken — is fixed in #27. CreateProjectV2FieldInput accepts iterationConfiguration, so create_iteration_field is a single mutation now: the field and its iterations land together, or nothing does. No more half-created fields.

    If a project still has an empty field stranded by the old code, calling create_iteration_field with that name adopts and configures it instead of dead-ending — the result carries adopted: true. Adoption is refused when the field already holds iterations, since reconfiguring one regenerates all iteration IDs and detaches every assignment (see #24).

    Verified live against a throwaway ProjectsV2, running the compiled tool:

    PASS  createProjectV2Field accepts iterationConfiguration at create time — iterations=[V1, V2] ids=[e844359e, 7568f3a9]
    PASS  duplicate name adopts the stranded empty field — adopted=true id-match=true
    PASS  populated field of the same name is refused, not overwritten
    6/6 checks passed
    

    Shipping in v1.6.0, together with #22 (same root cause, filed against a later version).

  3. self-assigned this
    on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions