{"record":{"id":"dd7c868ba9f108c3","repo":"sipeed/picoclaw","slug":"unsupported-type-q-only-openai-compatible-is","errorCode":null,"errorMessage":"unsupported --type %q (only 'openai-compatible' is supported)","messagePattern":"unsupported --type %q \\(only 'openai-compatible' is supported\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/picoclaw/internal/model/add.go","lineNumber":96,"sourceCode":"\t_ = cmd.MarkFlagRequired(\"api-base\")\n\t_ = cmd.MarkFlagRequired(\"api-key\")\n\n\treturn cmd\n}\n\ntype addOptions struct {\n\tapiBase   string\n\tapiKey    string\n\tmodelID   string\n\talias     string\n\tmodelType string\n\tstdin     io.Reader\n\tstdout    io.Writer\n}\n\nfunc runAdd(opt addOptions) error {\n\tif opt.modelType != \"\" && opt.modelType != \"openai-compatible\" {\n\t\treturn fmt.Errorf(\"unsupported --type %q (only 'openai-compatible' is supported)\", opt.modelType)\n\t}\n\tif opt.alias == \"\" {\n\t\topt.alias = defaultAliasName\n\t}\n\n\tselected := opt.modelID\n\tif selected == \"\" {\n\t\tentries, err := fetchOpenAIModels(opt.apiBase, opt.apiKey)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"fetch models: %w\", err)\n\t\t}\n\t\tif len(entries) == 0 {\n\t\t\treturn fmt.Errorf(\"no models returned by %s\", opt.apiBase)\n\t\t}\n\t\tselected, err = pickModel(opt.stdin, opt.stdout, entries)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/model/add.go#L78-L114","documentation":"picoclaw model add validates --type before doing anything else: the only accepted values are the empty string and the literal openai-compatible (the flag's default). The flag is a forward-compatibility placeholder — every endpoint picoclaw stores today is treated as OpenAI-compatible — so any other value is rejected immediately, before any network call or config change.","triggerScenarios":"Passing --type openai, --type anthropic, --type vllm, a typo like --type openai-compat, or any future-sounding provider name to picoclaw model add.","commonSituations":"Users assuming native provider support (Anthropic, Gemini, Bedrock) and trying to select it via --type; flags copy-pasted from other CLIs whose type vocabulary differs.","solutions":["Drop the flag entirely — it defaults to openai-compatible","Or pass --type openai-compatible explicitly","For a provider without an OpenAI-compatible endpoint, put a compatible gateway in front and point --api-base at it"],"exampleFix":"# before\npicoclaw model add --type anthropic -b https://api.anthropic.com -k sk-...\n\n# after\npicoclaw model add -b https://my-gateway.example.com/v1 -k sk-...","handlingStrategy":"validation","validationCode":"modelType = strings.TrimSpace(modelType)\nif modelType != \"\" && modelType != \"openai-compatible\" {\n  return fmt.Errorf(\"unsupported --type %q; omit the flag or pass openai-compatible\", modelType)\n}","typeGuard":"func isUnsupportedTypeError(err error) bool {\n  return err != nil && strings.Contains(err.Error(), \"unsupported --type\")\n}","tryCatchPattern":"if err := runAdd(opt); err != nil {\n  if isUnsupportedTypeError(err) {\n    // strip --type from the invocation and retry with the default\n  }\n  return err\n}","preventionTips":["Omit --type unless a future picoclaw release documents more values","For non-OpenAI providers, front them with an OpenAI-compatible gateway instead of the flag"],"tags":["cli","model","validation","flags"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}