sipeed/picoclaw · error

model identifier must not start with /

Error message

model identifier must not start with /

What it means

Validation guard in ModelConfig.Validate: the model identifier begins with a slash. A leading slash corrupts the provider request path (the identifier gets appended to a URL path), so it is rejected at config load time rather than producing a confusing 404 at request time.

Solutions

  1. Remove the leading / from the model identifier
  2. If the identifier was meant as a path-style route, check the provider's expected format — most want a bare model name
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/config/config.go:857 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/23f2197fbc3de5ae. Report an issue: GitHub.

Appendix: source

Thrown at pkg/config/config.go:857

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 //")
	}
	return nil
}

func (c *ModelConfig) SetAPIKey(value string) {
	if len(c.APIKeys) > 0 {
		c.APIKeys[0].Set(value)
	} else {
		c.APIKeys = append(c.APIKeys, NewSecureString(value))
	}
}

type ToolDiscoveryConfig struct {

View on GitHub (pinned to 49183d7e8d)