{"record":{"id":"aae016ec3b981106","repo":"router-for-me/CLIProxyAPI","slug":"decode-host-auth-get-runtime-request-w","errorCode":null,"errorMessage":"decode host auth get runtime request: %w","messagePattern":"decode host auth get runtime request: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pluginhost/auth_callbacks.go","lineNumber":99,"sourceCode":"\t}\n\tname := strings.TrimSpace(auth.FileName)\n\tif name == \"\" {\n\t\tname = strings.TrimSpace(auth.ID)\n\t}\n\tpath := strings.TrimSpace(authAttribute(auth, \"path\"))\n\treturn marshalRPCResult(rpcHostAuthGetResponse{\n\t\tAuthIndex: authIndex,\n\t\tName:      name,\n\t\tPath:      path,\n\t\tJSON:      json.RawMessage(rawJSON),\n\t})\n}\n\nfunc (h *Host) callHostAuthGetRuntime(ctx context.Context, request []byte) ([]byte, error) {\n\t_ = ctx\n\tvar req rpcHostAuthGetRequest\n\tif errUnmarshal := json.Unmarshal(request, &req); errUnmarshal != nil {\n\t\treturn nil, fmt.Errorf(\"decode host auth get runtime request: %w\", errUnmarshal)\n\t}\n\tauthIndex := strings.TrimSpace(req.AuthIndex)\n\tif authIndex == \"\" {\n\t\treturn nil, fmt.Errorf(\"auth_index is required\")\n\t}\n\tauth, errGet := h.authByIndex(authIndex)\n\tif errGet != nil {\n\t\treturn nil, errGet\n\t}\n\tentry := h.buildHostAuthFileEntry(auth)\n\tif entry == nil {\n\t\treturn nil, fmt.Errorf(\"auth runtime info not found for auth_index %s\", authIndex)\n\t}\n\treturn marshalRPCResult(pluginapi.HostAuthGetRuntimeResponse{Auth: *entry})\n}\n\nfunc (h *Host) callHostAuthSave(ctx context.Context, request []byte) ([]byte, error) {\n\tvar req pluginapi.HostAuthSaveRequest","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/pluginhost/auth_callbacks.go#L81-L117","documentation":"The host-side auth.get_runtime RPC callback failed to decode its request into rpcHostAuthGetRequest — invalid JSON or wrong field types. The runtime-info call is rejected before the auth manager is consulted.","triggerScenarios":"Plugin calls the host 'auth get runtime' RPC with a payload that is not valid JSON or where auth_index has the wrong type/name; identical failure class to auth.get decode but on the runtime variant.","commonSituations":"Plugin SDK protocol drift; hand-built RPC frames with typos; partially-written frames over stdio/socket transport.","solutions":["Validate the exact bytes sent for the runtime call (must decode into an object with a string auth_index)","Align plugin and host pluginapi versions and rebuild the plugin","Use SDK helpers for the RPC; restart the plugin process if the channel is desynced"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"payload, err := json.Marshal(map[string]string{\"auth_index\": idx})\nif err != nil { return err }\nif idx == \"\" { return errors.New(\"auth_index required for runtime info\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Share one request type between auth.get and auth.get_runtime in the plugin SDK","Reject blank indexes client-side before the RPC","Keep plugin/host pluginapi in lockstep"],"tags":["plugin","rpc","json","validation"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}