Skip to content

list_project_fields fails with JSON unmarshal error for single_select fields with optionsΒ #1418

@Dave76

Description

@Dave76

Bug Description

The list_project_fields tool fails when trying to retrieve project fields that include single_select fields with options (e.g., Status, Priority, Size fields). I found this when creating a custom agent that has been granted the ability to create/update issues and move them around a project board by changing the status.

Error Message

failed to list project fields: json: cannot unmarshal object into Go struct field ProjectV2FieldOption.options.name of type string

Steps to Reproduce

  1. Create or use a GitHub Project (v2) that has a single_select field with options (e.g., Status field with Backlog, In Progress, Done, etc.)

  2. Call list_project_fields tool with the project details:

    owner_type: "user"
    owner: "<username>"
    project_number: <project_number>
    
  3. Observe the JSON unmarshal error

Expected Behavior

The tool should successfully return all project fields, including single_select fields with their options listed.

Actual Behavior

The tool fails with a JSON unmarshal error because it's trying to unmarshal the options structure incorrectly.

Root Cause

The GitHub GraphQL API returns options for single_select fields as an array of objects with this structure:

{
  "options": [
    {
      "id": "aeba538c",
      "name": "Backlog"
    },
    {
      "id": "f75ad846",
      "name": "Ready"
    }
  ]
}

However, the Go struct appears to be expecting options.name to be a simple string type instead of an object with id and name properties.

Workaround

Until this is fixed, I have been using the GitHub GraphQL API directly to retrieve field information and placing the result in the agent definition so that the agent does not need to call the list_project_fields tool:

query {
  user(login: "username") {
    projectV2(number: 4) {
      fields(first: 20) {
        nodes {
          ... on ProjectV2Field {
            id
            name
            dataType
            databaseId
          }
          ... on ProjectV2SingleSelectField {
            id
            name
            dataType
            databaseId
            options {
              id
              name
            }
          }
        }
      }
    }
  }
}

Suggested Fix

Update the Go struct definition for ProjectV2FieldOption to properly handle the options structure where each option is an object containing id and name fields, rather than expecting a simple string.

Environment

  • GitHub MCP Server version: [latest as of November 2025]
  • Affected tool: list_project_fields
  • I get the same error when I test locally in VS CODE and using the Coding Agent in GitHub with the same agent definition.

Metadata

Metadata

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