{"record":{"id":"40222ceed1ae61fe","repo":"alibaba/open-code-review","slug":"unsupported-tab-for-custom-model-v","errorCode":null,"errorMessage":"unsupported tab for custom model: %v","messagePattern":"unsupported tab for custom model: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/provider_tui.go","lineNumber":875,"sourceCode":"\t\tprevEntry := cloneProviderEntry(entry)\n\t\tentry.Models = append(entry.Models, name)\n\t\tm.existingCfg.Providers[provider.Name] = entry\n\t\t// Intentionally do not mutate m.providers[officialIdx].Models: that slice\n\t\t// is a read-only snapshot from the provider registry (llm.ListProviders).\n\t\t// User-added models live only in existingCfg.Providers; models() merges both\n\t\t// at display time, unlike custom tab where customProviders is the sole list.\n\t\tif m.configPath != \"\" {\n\t\t\tif err := saveConfig(m.configPath, m.existingCfg); err != nil {\n\t\t\t\tif !m.reloadConfigAfterSaveFailure() {\n\t\t\t\t\tm.existingCfg.Providers[provider.Name] = prevEntry\n\t\t\t\t}\n\t\t\t\treturn false, fmt.Errorf(\"failed to save models: %w\", err)\n\t\t\t}\n\t\t}\n\t\tm.savedInSession = true\n\t\treturn true, nil\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unsupported tab for custom model: %v\", m.activeTab)\n\t}\n}\n\nconst maskedSecretDisplayLen = 20\n\nfunc maskedSecretPlaceholder() string {\n\treturn strings.Repeat(\"*\", maskedSecretDisplayLen)\n}\n\n// isUserEditMsg reports whether msg represents user text input (typing or paste).\nfunc isUserEditMsg(msg tea.Msg) bool {\n\tswitch msg.(type) {\n\tcase tea.KeyPressMsg, tea.PasteMsg:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}","sourceCodeStart":857,"sourceCodeEnd":893,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/provider_tui.go#L857-L893","documentation":"Guard in the provider TUI's model-add flow: the save routine was invoked from a tab whose context is not a recognized custom-model context. The tab value (e.g. official provider list, an edit form, search) cannot have models added to it, so the function refuses rather than writing a model to the wrong provider entry.","triggerScenarios":"Thrown at cmd/opencodereview/provider_tui.go:875 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report this as a bug: this message indicates an internal state error where the add-model flow was invoked from an unexpected tab","Avoid manually constructing model-add requests for official providers through this path; user models for official providers belong in existingCfg.Providers only"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}