{"record":{"id":"abe166c100d4bff9","repo":"github/github-mcp-server","slug":"invalid-detail-q-must-be-one-of-none-stats","errorCode":null,"errorMessage":"invalid detail %q: must be one of \"none\", \"stats\", \"full_patch\"","messagePattern":"invalid detail %q: must be one of \"none\", \"stats\", \"full_patch\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/minimal_types.go","lineNumber":1780,"sourceCode":"\t// commitDetailNone omits Stats and Files entirely.\n\tcommitDetailNone commitDetail = \"none\"\n\t// commitDetailStats includes Stats and Files with metadata only\n\t// (filename, status, additions, deletions, changes) but no patch text.\n\tcommitDetailStats commitDetail = \"stats\"\n\t// commitDetailFullPatch additionally includes the unified diff for each file.\n\tcommitDetailFullPatch commitDetail = \"full_patch\"\n)\n\n// parseCommitDetail validates the user-supplied detail value and returns the\n// default (stats) when the value is empty.\nfunc parseCommitDetail(s string) (commitDetail, error) {\n\tswitch s {\n\tcase \"\":\n\t\treturn commitDetailStats, nil\n\tcase string(commitDetailNone), string(commitDetailStats), string(commitDetailFullPatch):\n\t\treturn commitDetail(s), nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"invalid detail %q: must be one of \\\"none\\\", \\\"stats\\\", \\\"full_patch\\\"\", s)\n\t}\n}\n\nfunc convertToMinimalCommit(commit *github.RepositoryCommit, detail commitDetail) MinimalCommit {\n\tminimalCommit := newMinimalCommitFromCore(\n\t\tcommit.GetSHA(),\n\t\tcommit.GetHTMLURL(),\n\t\tcommit.Commit,\n\t\tcommit.Author,\n\t\tcommit.Committer,\n\t)\n\n\tif detail == commitDetailNone {\n\t\treturn minimalCommit\n\t}\n\n\tif commit.Stats != nil {\n\t\tminimalCommit.Stats = &MinimalCommitStats{","sourceCodeStart":1762,"sourceCodeEnd":1798,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/minimal_types.go#L1762-L1798","documentation":"Thrown by parseCommitDetail in pkg/github/minimal_types.go when a tool's 'detail' argument is not one of the allowed values \"none\", \"stats\", or \"full_patch\". The commit tools (get_commit, list_commits in repositories.go) use it to select how much of a commit to return. An empty string is valid and defaults to \"stats\", so this error only fires on a non-empty wrong value.","triggerScenarios":"Calling the get_commit or list_commits MCP tool with detail set to anything except \"none\"/\"stats\"/\"full_patch\" — e.g. detail=\"patches\", detail=\"full\", detail=\"FULL_PATCH\", or a number/boolean instead of a string.","commonSituations":"Typing \"full\" instead of \"full_patch\"; assuming the API mirrors GitHub REST's verbose diff modes; casing mistakes; older workflows written before the detail argument accepted \"full_patch\"; passing a value copied from a different tool's schema.","solutions":["Set detail to one of \"none\", \"stats\", or \"full_patch\" (exact lowercase, with underscore).","Omit the detail argument entirely to get the default \"stats\" behavior.","If you need the raw diff/patch content, use detail \"full_patch\"; if you need no files at all, use \"none\".","Re-read the tool's inputSchema returned by tools/list — the enum there is the source of truth for your server version."],"exampleFix":"// before\ngithub.callTool({ name: \"get_commit\", arguments: { owner, repo, sha, detail: \"full\" } });\n// after\ngithub.callTool({ name: \"get_commit\", arguments: { owner, repo, sha, detail: \"full_patch\" } });","handlingStrategy":"validation","validationCode":"const COMMIT_DETAILS = [\"none\", \"stats\", \"full_patch\"];\nfunction validDetail(d) {\n  return d === undefined || d === null || COMMIT_DETAILS.includes(d);\n}\n// before calling get_commit/list_commits:\nif (!validDetail(args.detail)) {\n  throw new Error(`detail must be one of ${COMMIT_DETAILS.join(\", \")} or omitted`);\n}","typeGuard":"function isCommitDetail(v: unknown): v is \"none\" | \"stats\" | \"full_patch\" | undefined {\n  return v === undefined || v === \"none\" || v === \"stats\" || v === \"full_patch\";\n}","tryCatchPattern":"In MCP clients the tool call returns an error result rather than throwing: check result.isError and match /invalid detail/ in the message, then re-ask the model/user with the allowed enum listed.","preventionTips":["Centralize tool argument construction in typed helper functions instead of ad-hoc objects.","Cache the tool's inputSchema from tools/list and validate enums client-side.","Lack of a detail argument is always safe — default is stats; omit rather than guess."],"tags":["validation","enum","commits","mcp-tool","argument-parsing"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}