{"record":{"id":"aef162fb8e74e167","repo":"router-for-me/CLIProxyAPI","slug":"plugin-store-auth-missing-s","errorCode":null,"errorMessage":"plugin store auth missing %s","messagePattern":"plugin store auth missing (.+?)","errorType":"http","errorClass":null,"httpStatus":502,"severity":"error","filePath":"internal/pluginstore/auth.go","lineNumber":464,"sourceCode":"\treturn strings.HasPrefix(requestPath, rulePath+\"/\")\n}\n\nfunc authAppliesTo(item AuthConfig, kind string) bool {\n\tif len(item.ApplyTo) == 0 {\n\t\treturn true\n\t}\n\tfor _, value := range item.ApplyTo {\n\t\tif strings.EqualFold(strings.TrimSpace(value), kind) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc envValueRequired(envName string, field string) (string, error) {\n\tenvName = strings.TrimSpace(envName)\n\tif envName == \"\" {\n\t\treturn \"\", fmt.Errorf(\"plugin store auth missing %s\", field)\n\t}\n\tvalue := strings.TrimSpace(os.Getenv(envName))\n\tif value == \"\" {\n\t\treturn \"\", fmt.Errorf(\"plugin store auth env %s is empty\", envName)\n\t}\n\treturn value, nil\n}\n","sourceCodeStart":446,"sourceCodeEnd":472,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/pluginstore/auth.go#L446-L472","documentation":"envValueRequired was called with an empty env-var name for a required field (the %s names the field, e.g. token-env/username-env). internal/pluginstore/auth.go resolves secrets from the environment by name; a blank name means the auth rule is structurally incomplete — typically a bearer rule with no token-env or a basic rule missing username-env/password-env.","triggerScenarios":"An auth rule declares type: bearer (or basic/header) but the corresponding *-env field is absent or empty in config, and the rule matches a store request so resolution is attempted.","commonSituations":"Truncated YAML block (field deleted during edit); type changed to bearer without adding token-env; JSON management payload omits the key; indentation puts the env field under a different mapping.","solutions":["Add the missing env field for the declared type: bearer/github-token -> token-env; basic -> username-env + password-env; header -> header-value-env (+ header-name)","Or set type: none if the store needs no auth","Validate the full auth rule against config.example.yaml for its type"],"exampleFix":"# before\n- match: https://plugins.example.com\n  type: bearer\n\n# after\n- match: https://plugins.example.com\n  type: bearer\n  token-env: PLUGIN_TOKEN","handlingStrategy":"validation","validationCode":"func ruleEnvFieldsComplete(r AuthConfig) error {\n    switch strings.ToLower(strings.TrimSpace(r.Type)) {\n    case \"\", \"none\":\n        return nil\n    case \"bearer\", \"github-token\":\n        if strings.TrimSpace(r.TokenEnv) == \"\" { return fmt.Errorf(\"bearer rule missing token-env\") }\n    case \"basic\":\n        if strings.TrimSpace(r.UsernameEnv) == \"\" || strings.TrimSpace(r.PasswordEnv) == \"\" { return fmt.Errorf(\"basic rule missing username-env/password-env\") }\n    case \"header\":\n        if strings.TrimSpace(r.HeaderValueEnv) == \"\" { return fmt.Errorf(\"header rule missing header-value-env\") }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate auth rules at config load and refuse to start on incomplete rules","Copy auth examples from config.example.yaml and change values, not structure"],"tags":["config","auth","plugin-store","env"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}