{"record":{"id":"79ad43c404ece50c","repo":"goharbor/harbor","slug":"set-api-key-in-s-is-invalid","errorCode":null,"errorMessage":"set api key in %s is invalid","messagePattern":"set api key in (.+?) is invalid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/pkg/reg/adapter/quay/auth/apikey.go","lineNumber":58,"sourceCode":"\t\tkey:   key,\n\t\tvalue: value,\n\t\tin:    in,\n\t}\n}\n\n// Modify implements modifier.Modifier\nfunc (a *apiKeyAuthorizer) Modify(r *http.Request) error {\n\tswitch a.in {\n\tcase APIKeyInHeader:\n\t\tr.Header.Set(a.key, a.value)\n\t\treturn nil\n\tcase APIKeyInQuery:\n\t\tquery := r.URL.Query()\n\t\tquery.Add(a.key, a.value)\n\t\tr.URL.RawQuery = query.Encode()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"set api key in %s is invalid\", a.in)\n}\n","sourceCodeStart":40,"sourceCodeEnd":60,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/pkg/reg/adapter/quay/auth/apikey.go#L40-L60","documentation":"Returned by apiKeyAuthorizer.Modify when the configured API key placement is neither 'header' nor 'query'. This is a default-branch guard after an exhaustive switch: the authorizer was constructed with an unsupported APIKeyIn value, so no auth material can be attached to the request. The input at fault is the 'in' field set at construction time.","triggerScenarios":"Thrown at src/pkg/reg/adapter/quay/auth/apikey.go:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Construct the authorizer with APIKeyInHeader or APIKeyInQuery only","If a new placement is needed, extend the switch in Modify to handle it","Validate the 'in' value at authorizer construction to fail early"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","contentChangedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}