{"record":{"id":"84ae1cca24a9df85","repo":"github/github-mcp-server","slug":"missing-required-parameter-ref","errorCode":null,"errorMessage":"missing required parameter: ref","messagePattern":"missing required parameter: ref","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/github/server.go","lineNumber":195,"sourceCode":"\tif title == \"\" {\n\t\ttitle = \"GitHub MCP Server\"\n\t}\n\n\t// Create a new MCP server\n\ts := mcp.NewServer(&mcp.Implementation{\n\t\tName:    name,\n\t\tTitle:   title,\n\t\tVersion: version,\n\t\tIcons:   octicons.Icons(\"mark-github\"),\n\t}, opts)\n\n\treturn s\n}\n\nfunc CompletionsHandler(getClient GetClientFn) func(ctx context.Context, req *mcp.CompleteRequest) (*mcp.CompleteResult, error) {\n\treturn func(ctx context.Context, req *mcp.CompleteRequest) (*mcp.CompleteResult, error) {\n\t\tif req == nil || req.Params == nil || req.Params.Ref == nil {\n\t\t\treturn nil, fmt.Errorf(\"missing required parameter: ref\")\n\t\t}\n\t\tswitch req.Params.Ref.Type {\n\t\tcase \"ref/resource\":\n\t\t\tif strings.HasPrefix(req.Params.Ref.URI, \"repo://\") {\n\t\t\t\treturn RepositoryResourceCompletionHandler(getClient)(ctx, req)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"unsupported resource URI: %s\", req.Params.Ref.URI)\n\t\tcase \"ref/prompt\":\n\t\t\treturn nil, nil\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unsupported ref type: %s\", req.Params.Ref.Type)\n\t\t}\n\t}\n}\n\nfunc MarshalledTextResult(v any) *mcp.CallToolResult {\n\tdata, err := json.Marshal(v)\n\tif err != nil {","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/server.go#L177-L213","documentation":"The MCP completions/complete handler received a request whose Params or Params.Ref is nil. The MCP spec requires every completion request to carry a ref (ref/prompt with a name, or ref/resource with a uri); the server fails fast rather than guessing what to complete.","triggerScenarios":"An MCP client sends complete with an empty params object, omits ref, or serializes ref as an omitempty pointer that gets dropped; hand-rolled test harnesses posting partial JSON.","commonSituations":"Buggy or experimental clients; SDK versions where ref is a pointer that is easy to leave unset; probing scripts that fire completion before full initialization.","solutions":["Fix the client to always include ref with a valid type (ref/prompt or ref/resource)","If writing a client, verify serialization keeps non-zero ref fields","Server operators: capture the client name/version from request logs to identify the offender"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// client-side, before sending completion/complete\nif req.Params == nil || req.Params.Ref == nil {\n\treturn fmt.Errorf(\"refusing to send completion request without ref\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always populate ref (type plus name or uri) on completion requests","Assert serialized request JSON contains ref in client tests","Guard against omitempty dropping zero-value ref fields in generated SDKs"],"tags":["mcp","protocol","validation"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}