{"record":{"id":"eeb7fed408e7bacf","repo":"router-for-me/CLIProxyAPI","slug":"auth-provider-s-returned-invalid-auth-data","errorCode":null,"errorMessage":"auth provider %s returned invalid auth data","messagePattern":"auth provider (.+?) returned invalid auth data","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pluginhost/auth_provider.go","lineNumber":244,"sourceCode":"\t}\n\tif !resp.Handled {\n\t\treturn nil, false, nil\n\t}\n\tdatas := pluginAuthParseResponseAuths(resp)\n\tauths = make([]*coreauth.Auth, 0, len(datas))\n\tfor _, data := range datas {\n\t\tif strings.TrimSpace(data.Provider) == \"\" {\n\t\t\tdata.Provider = req.Provider\n\t\t}\n\t\tif strings.TrimSpace(data.Provider) == \"\" {\n\t\t\tdata.Provider = normalizeProviderID(provider.Identifier())\n\t\t}\n\t\tif normalizeProviderID(data.Provider) == \"\" {\n\t\t\treturn nil, true, fmt.Errorf(\"auth provider %s returned auth without provider\", record.id)\n\t\t}\n\t\tparsed := h.AuthDataToCoreAuth(data, req.Path, req.FileName)\n\t\tif parsed == nil {\n\t\t\treturn nil, true, fmt.Errorf(\"auth provider %s returned invalid auth data\", record.id)\n\t\t}\n\t\tauths = append(auths, parsed)\n\t}\n\treturn auths, true, nil\n}\n\nfunc pluginAuthParseResponseAuths(resp pluginapi.AuthParseResponse) []pluginapi.AuthData {\n\tif len(resp.Auths) > 0 {\n\t\treturn append([]pluginapi.AuthData(nil), resp.Auths...)\n\t}\n\treturn []pluginapi.AuthData{resp.Auth}\n}\n\nfunc (h *Host) StartLogin(ctx context.Context, provider string, baseURL string) (pluginapi.AuthLoginStartResponse, bool, error) {\n\trecord := h.authProviderRecord(provider)\n\tif record == nil {\n\t\treturn pluginapi.AuthLoginStartResponse{}, false, nil\n\t}","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/pluginhost/auth_provider.go#L226-L262","documentation":"Thrown by Host.callParseAuths when h.AuthDataToCoreAuth(data, req.Path, req.FileName) returns nil for an entry returned by the plugin's ParseAuth. The converter rejects AuthData it cannot turn into a core auth (invalid required fields for the provider type), so the plugin response is treated as invalid rather than partially accepted.","triggerScenarios":"Plugin returns AuthData missing required fields for the declared provider (e.g. no token/credentials payload), with an unrecognized provider type, or with fields in the wrong shape, causing the converter to bail.","commonSituations":"Plugin emitting a provider-specific schema the host no longer recognizes after an upgrade; half-initialized AuthData structs; test stubs returning skeleton data.","solutions":["Log/inspect the AuthData the plugin returned and compare with the field requirements for that provider in the host's AuthDataToCoreAuth","Fix the plugin to emit the complete, correctly typed AuthData for the provider","Align plugin and host versions so the auth schema matches"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// plugin side: sanity-check entries before returning\nfor _, a := range auths {\n    if strings.TrimSpace(a.Provider) == \"\" || len(a.Payload()) == 0 {\n        return nil, fmt.Errorf(\"incomplete auth data for %s\", a.Provider)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"returned invalid auth data\") {\n    // dump the AuthData (redacted) and fix missing/typed-wrong fields in the plugin\n}","preventionTips":["Pin plugin and host versions together so auth schemas match","Cover ParseAuth with contract tests using representative payloads"],"tags":["go","pluginhost","auth","plugin","contract","validation"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}