{"record":{"id":"ab4218b277616373","repo":"plandex-ai/plandex","slug":"error-checking-api-keys-credentials-v","errorCode":null,"errorMessage":"error checking API keys/credentials: %v","messagePattern":"error checking API keys/credentials: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/model_credentials.go","lineNumber":67,"sourceCode":"func CheckCredentialStatus(opts shared.ModelProviderOptions, claudeMaxEnabled bool) (CredentialCheckResult, error) {\n\tpublishersToProviders := groupProvidersByPublisher(opts)\n\n\tselectedAuthVars := map[string]string{}\n\tvar publisherStatuses []PublisherCredentialStatus\n\tallSatisfied := true\n\n\tfor publisher, providers := range publishersToProviders {\n\t\tvar selectedProvider *ProviderCredentialStatus\n\t\tpartialProviders := []ProviderCredentialStatus{}\n\n\t\tfor _, provider := range providers {\n\t\t\tif provider.Config.HasClaudeMaxAuth && !claudeMaxEnabled {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tauthVars, err := ResolveProviderAuthVars(provider.Config)\n\t\t\tif err != nil {\n\t\t\t\treturn CredentialCheckResult{}, fmt.Errorf(\"error checking API keys/credentials: %v\", err)\n\t\t\t}\n\t\t\tstatus, missingVars, err := checkProviderCredentialStatus(provider.Config, authVars)\n\t\t\tif err != nil {\n\t\t\t\treturn CredentialCheckResult{}, fmt.Errorf(\"error checking API keys/credentials: %v\", err)\n\t\t\t}\n\n\t\t\tproviderStatus := ProviderCredentialStatus{\n\t\t\t\tProviderComposite: provider.Config.ToComposite(),\n\t\t\t\tStatus:            status,\n\t\t\t\tMissingVars:       missingVars,\n\t\t\t}\n\n\t\t\tif status == FullySatisfied {\n\t\t\t\tselectedProvider = &providerStatus\n\t\t\t\tmergeAuthVars(selectedAuthVars, authVars)\n\t\t\t\tbreak // first fully satisfied provider found, stop looking further\n\t\t\t} else if status == PartiallySatisfied {\n\t\t\t\tpartialProviders = append(partialProviders, providerStatus)","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/model_credentials.go#L49-L85","documentation":"CheckCredentialStatus resolves auth variables per provider and grades each provider's credentials. This error wraps a failure from ResolveProviderAuthVars (line 67) — i.e. credentials could not even be resolved (bad account-credential store or unreadable credential file) — before any status grading happens.","triggerScenarios":"Calling CheckCredentialStatus(opts, claudeMaxEnabled) when ResolveProviderAuthVars returns an error for some provider: GetAccountCredentials fails for a HasClaudeMaxAuth provider, or a MaybeJSONFilePath ExtraAuthVar points to an unreadable file.","commonSituations":"Corrupt or locked local credentials store, GOOGLE_APPLICATION_CREDENTIALS-style var pointing at a deleted/moved JSON key file, or a provider marked ClaudeMax-auth while the credentials file is inaccessible.","solutions":["Read the wrapped %v cause to identify the failing provider and sub-error.","If it is a file-load failure, verify the credential file path in the env var exists and is readable.","If it is account credentials, re-authenticate / regenerate the local credentials store.","Temporarily disable the offending provider config (or set SkipAuth) to confirm which provider breaks the check."],"exampleFix":"// before\nres, err := CheckCredentialStatus(opts, claudeMaxEnabled)\nif err != nil { log.Fatal(err) }\n// after\nres, err := CheckCredentialStatus(opts, claudeMaxEnabled)\nif err != nil {\n    log.Printf(\"credential check failed: %v\", err) // inspect wrapped cause\n    return err\n}","handlingStrategy":"validation","validationCode":"func credentialFilesExist(cfgs []*shared.ModelProviderConfigSchema) error {\n    for _, c := range cfgs {\n        for _, v := range c.ExtraAuthVars {\n            if v.MaybeJSONFilePath {\n                p := os.Getenv(v.Var)\n                if p != \"\" && !strings.HasPrefix(p, \"{\") {\n                    if _, err := os.Stat(p); err != nil { return fmt.Errorf(\"%s: %w\", v.Var, err) }\n                }\n            }\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"res, err := CheckCredentialStatus(opts, claudeMaxEnabled)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to load file for\") {\n        log.Printf(\"fix credential file path: %v\", err)\n    }\n    return err\n}","preventionTips":["Use absolute paths for credential-file env vars","Stat credential files before startup","Keep the account credentials store readable by the running user","Re-authenticate after rotating credentials"],"tags":["credentials","auth","config"],"backgroundTag":"credential-resolution-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}