{"record":{"id":"9b6ed790bb48c473","repo":"router-for-me/CLIProxyAPI","slug":"invalid-callback-url","errorCode":null,"errorMessage":"invalid callback URL","messagePattern":"invalid callback URL","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/misc/oauth.go","lineNumber":67,"sourceCode":"\n// ParseOAuthCallback extracts OAuth parameters from a callback URL.\n// It returns nil when the input is empty.\nfunc ParseOAuthCallback(input string) (*OAuthCallback, error) {\n\ttrimmed := strings.TrimSpace(input)\n\tif trimmed == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tcandidate := trimmed\n\tif !strings.Contains(candidate, \"://\") {\n\t\tif strings.HasPrefix(candidate, \"?\") {\n\t\t\tcandidate = \"http://localhost\" + candidate\n\t\t} else if strings.ContainsAny(candidate, \"/?#\") || strings.Contains(candidate, \":\") {\n\t\t\tcandidate = \"http://\" + candidate\n\t\t} else if strings.Contains(candidate, \"=\") {\n\t\t\tcandidate = \"http://localhost/?\" + candidate\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"invalid callback URL\")\n\t\t}\n\t}\n\n\tparsedURL, err := url.Parse(candidate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tquery := parsedURL.Query()\n\tcode := strings.TrimSpace(query.Get(\"code\"))\n\tstate := strings.TrimSpace(query.Get(\"state\"))\n\terrCode := strings.TrimSpace(query.Get(\"error\"))\n\terrDesc := strings.TrimSpace(query.Get(\"error_description\"))\n\n\tif parsedURL.Fragment != \"\" {\n\t\tif fragQuery, errFrag := url.ParseQuery(parsedURL.Fragment); errFrag == nil {\n\t\t\tif code == \"\" {\n\t\t\t\tcode = strings.TrimSpace(fragQuery.Get(\"code\"))","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/misc/oauth.go#L49-L85","documentation":"Error \"invalid callback URL\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/misc/oauth.go:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a well-formed absolute OAuth callback URL.","Verify the callback URL scheme and host in the configuration."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}