sipeed/picoclaw · error

model is required

Error message

model is required

What it means

Validation guard in ModelConfig.Validate: model_name is present but the model field (the provider-side model identifier passed to the API, e.g. gpt-4o) is empty. Without it the provider request has no model to route to, so validation fails.

Solutions

  1. Set the model field to the exact identifier the provider expects
  2. Copy the identifier from the provider's model list; beware of trailing whitespace
  3. Check YAML key spelling — model, not model_name or model_id, for the provider identifier
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/config/config.go:844 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at pkg/config/config.go:844

func (c *ModelConfig) APIKey() string {
	if len(c.APIKeys) > 0 {
		return c.APIKeys[0].String()
	}
	return ""
}

// IsVirtual returns true if this model was generated from multi-key expansion.
func (c *ModelConfig) IsVirtual() bool {
	return c.isVirtual
}

// Validate checks if the ModelConfig has all required fields.
func (c *ModelConfig) Validate() error {
	if c.ModelName == "" {
		return fmt.Errorf("model_name is required")
	}
	if c.Model == "" {
		return fmt.Errorf("model is required")
	}
	if _, err := providercommon.NormalizeToolSchemaTransform(c.ToolSchemaTransform); err != nil {
		return err
	}

	// Reject whitespace in model identifier
	if strings.ContainsAny(c.Model, " \t\n\r") {
		return fmt.Errorf("model identifier contains whitespace")
	}

	// Reject leading slash
	if strings.HasPrefix(c.Model, "/") {
		return fmt.Errorf("model identifier must not start with /")
	}

	// Reject consecutive slashes
	if strings.Contains(c.Model, "//") {
		return fmt.Errorf("model identifier must not contain //")

View on GitHub (pinned to 49183d7e8d)