sipeed/picoclaw · error

--model or MEMBENCH_MODEL is required for LLM eval mode

Error message

--model or MEMBENCH_MODEL is required for LLM eval mode

What it means

Validation guard in buildLLMOptions: LLM eval mode was selected, but no model name resolves from either the --model flag or the MEMBENCH_MODEL environment variable (flags take precedence via envOrFlag). Without a model the OpenAI-compatible endpoint cannot be addressed, so client construction is refused up front.

Solutions

  1. Pass --model <name> on the eval/run command
  2. Export MEMBENCH_MODEL=<name> in the shell or .env
  3. Document the variable next to MEMBENCH_API_BASE/MEMBENCH_API_KEY so all three are configured together
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/membench/main.go:343 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/401f09a5ad24e5e4. Report an issue: GitHub.

Appendix: source

Thrown at cmd/membench/main.go:343

	return os.Getenv(envKey)
}

// buildLLMOptions resolves LLM client configuration from flags and environment
// variables. Flag values take precedence over environment variables.
//
// Environment variables:
//
//	MEMBENCH_API_BASE  – OpenAI-compatible base URL  (default http://127.0.0.1:8080/v1)
//	MEMBENCH_API_KEY   – Bearer token for the endpoint
//	MEMBENCH_MODEL     – Model name to send in the request
func buildLLMOptions() (LLMClientOptions, error) {
	base := envOrFlag(flagAPIBase, "MEMBENCH_API_BASE")
	if base == "" {
		base = "http://127.0.0.1:8080/v1"
	}
	model := envOrFlag(flagModel, "MEMBENCH_MODEL")
	if model == "" {
		return LLMClientOptions{}, fmt.Errorf(
			"--model or MEMBENCH_MODEL is required for LLM eval mode",
		)
	}
	apiKey := envOrFlag(flagAPIKey, "MEMBENCH_API_KEY")

	if flagTimeout <= 0 {
		return LLMClientOptions{}, fmt.Errorf("--timeout must be > 0, got %d", flagTimeout)
	}

	return LLMClientOptions{
		BaseURL:    base,
		Model:      model,
		APIKey:     apiKey,
		NoThinking: flagNoThinking,
		Timeout:    time.Duration(flagTimeout) * time.Second,
		MaxRetries: flagRetries,
	}, nil
}

View on GitHub (pinned to 49183d7e8d)