sipeed/picoclaw · error

unsupported --type %q (only 'openai-compatible' is supported

Error message

unsupported --type %q (only 'openai-compatible' is supported)

What it means

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.

Source

Thrown at cmd/picoclaw/internal/model/add.go:96

	_ = cmd.MarkFlagRequired("api-base")
	_ = cmd.MarkFlagRequired("api-key")

	return cmd
}

type addOptions struct {
	apiBase   string
	apiKey    string
	modelID   string
	alias     string
	modelType string
	stdin     io.Reader
	stdout    io.Writer
}

func runAdd(opt addOptions) error {
	if opt.modelType != "" && opt.modelType != "openai-compatible" {
		return fmt.Errorf("unsupported --type %q (only 'openai-compatible' is supported)", opt.modelType)
	}
	if opt.alias == "" {
		opt.alias = defaultAliasName
	}

	selected := opt.modelID
	if selected == "" {
		entries, err := fetchOpenAIModels(opt.apiBase, opt.apiKey)
		if err != nil {
			return fmt.Errorf("fetch models: %w", err)
		}
		if len(entries) == 0 {
			return fmt.Errorf("no models returned by %s", opt.apiBase)
		}
		selected, err = pickModel(opt.stdin, opt.stdout, entries)
		if err != nil {
			return err
		}

View on GitHub (pinned to 49183d7e8d)

Solutions

  1. Drop the flag entirely — it defaults to openai-compatible
  2. Or pass --type openai-compatible explicitly
  3. For a provider without an OpenAI-compatible endpoint, put a compatible gateway in front and point --api-base at it

Example fix

# before
picoclaw model add --type anthropic -b https://api.anthropic.com -k sk-...

# after
picoclaw model add -b https://my-gateway.example.com/v1 -k sk-...
Defensive patterns

Strategy: validation

Validate before calling

modelType = strings.TrimSpace(modelType)
if modelType != "" && modelType != "openai-compatible" {
  return fmt.Errorf("unsupported --type %q; omit the flag or pass openai-compatible", modelType)
}

Type guard

func isUnsupportedTypeError(err error) bool {
  return err != nil && strings.Contains(err.Error(), "unsupported --type")
}

Try / catch

if err := runAdd(opt); err != nil {
  if isUnsupportedTypeError(err) {
    // strip --type from the invocation and retry with the default
  }
  return err
}

Prevention

When it happens

Trigger: Passing --type openai, --type anthropic, --type vllm, a typo like --type openai-compat, or any future-sounding provider name to picoclaw model add.

Common situations: 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.

Related errors


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/dd7c868ba9f108c3. Report an issue: GitHub.