{"record":{"id":"614d0b48110534a6","repo":"github/github-mcp-server","slug":"parameter-s-must-not-be-empty","errorCode":null,"errorMessage":"parameter %s must not be empty","messagePattern":"parameter (.+?) must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/params.go","lineNumber":52,"sourceCode":"\treturn\n}\n\n// OptionalNullableStringParam preserves omitted, null, and non-empty string values.\nfunc OptionalNullableStringParam(args map[string]any, p string) (*string, bool, error) {\n\tvalue, ok := args[p]\n\tif !ok {\n\t\treturn nil, false, nil\n\t}\n\tif value == nil {\n\t\treturn nil, true, nil\n\t}\n\n\tstringValue, ok := value.(string)\n\tif !ok {\n\t\treturn nil, true, fmt.Errorf(\"parameter %s is not of type string or null, is %T\", p, value)\n\t}\n\tif stringValue == \"\" {\n\t\treturn nil, true, fmt.Errorf(\"parameter %s must not be empty\", p)\n\t}\n\treturn &stringValue, true, nil\n}\n\n// isAcceptedError checks if the error is an accepted error.\nfunc isAcceptedError(err error) bool {\n\tvar acceptedError *github.AcceptedError\n\treturn errors.As(err, &acceptedError)\n}\n\n// toInt converts a value to int, handling both float64 and string representations.\n// Some MCP clients send numeric values as strings. It rejects NaN, ±Inf,\n// fractional values, and values outside the int range.\nfunc toInt(val any) (int, error) {\n\tvar f float64\n\tswitch v := val.(type) {\n\tcase float64:\n\t\tf = v","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/params.go#L34-L70","documentation":"Thrown by OptionalNullableStringParam in pkg/github/params.go when an explicitly present argument is the empty string. The helper preserves omitted and null as unset, but an empty string is rejected because GitHub would reject it as a bogus filter/type value. Affects the same nullable string fields (issue type, project filter, etc.).","triggerScenarios":"Passing type: \"\" or filter: \"\" to issue/project tools; templating code that builds arguments from empty variables (e.g. ${issueType} renders as \"\"); 'clear the value' attempts done by sending \"\" instead of null.","commonSituations":"Client code doing args.type = getValue() || \"\"; LLMs filling every schema field with empty strings; migration from an API where \"\" meant 'unset'.","solutions":["Omit the field entirely or send null instead of \"\".","Fix client-side defaults: filter empty strings out of the arguments object before the call.","If the value comes from a variable, guard with a conditional so the key is only set when the value is non-empty."],"exampleFix":"// before\nconst args = { owner, repo, issue_number: 5, type: issueType ?? \"\" };\n// after\nconst args = { owner, repo, issue_number: 5 };\nif (issueType) args.type = issueType;","handlingStrategy":"validation","validationCode":"function stripEmptyStrings(args) {\n  for (const k of Object.keys(args)) {\n    if (args[k] === \"\") delete args[k]; // omission == unset for nullable strings\n  }\n  return args;\n}\n// use before every tool call: stripEmptyStrings(arguments)","typeGuard":null,"tryCatchPattern":"On /must not be empty/, delete the offending key (or set null) and retry; the call is otherwise valid.","preventionTips":["Avoid `|| \"\"` defaults — they convert missing values into empty strings, the exact trigger.","Only set nullable-string keys when the value is truthy.","To clear a field server-side, send null, never \"\"."],"tags":["validation","empty-string","nullable","argument-parsing","mcp-tool"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}