sipeed/picoclaw · error

turn_profile.%s.mode has unsupported mode %q

Error message

turn_profile.%s.mode has unsupported mode %q

What it means

Returned by validateTurnProfileBlock when a turn_profile block's mode is a string that matches none of default/off/custom (the switch default branch). The invalid value is echoed with %q so you can see exact whitespace/case issues. This is pure input validation on the mode field of any turn_profile block.

Source

Thrown at pkg/config/turn_profile.go:111

	}
	if err := validateTurnProfileBlock("tools", profile.Tools, true); err != nil {
		return err
	}
	return nil
}

func validateTurnProfileBlock(field string, block TurnProfileBlock, allowCustom bool) error {
	mode := block.Mode.Effective()
	switch mode {
	case TurnProfileModeDefault, TurnProfileModeOff:
		return nil
	case TurnProfileModeCustom:
		if allowCustom {
			return nil
		}
		return fmt.Errorf("turn_profile.%s.mode custom is not supported in this version", field)
	default:
		return fmt.Errorf("turn_profile.%s.mode has unsupported mode %q", field, block.Mode)
	}
}

func cleanStringList(values []string) []string {
	if len(values) == 0 {
		return nil
	}
	out := make([]string, 0, len(values))
	seen := make(map[string]struct{}, len(values))
	for _, value := range values {
		value = strings.TrimSpace(value)
		if value == "" {
			continue
		}
		if _, ok := seen[value]; ok {
			continue
		}
		seen[value] = struct{}{}

View on GitHub (pinned to 49183d7e8d)

Solutions

  1. Set mode to one of the exact lowercase strings: default, off, or custom
  2. Check the %q output in the error for hidden whitespace or wrong case and correct it
  3. Pre-validate all mode values against the allowed set when generating configs programmatically (see typeGuard)

Example fix

# before
turn_profile:
  tools:
    mode: enabled

# after
turn_profile:
  tools:
    mode: default
Defensive patterns

Strategy: type-guard

Validate before calling

var allowedModes = map[string]bool{"default": true, "off": true, "custom": true}
func modeAllowed(m string) bool { return allowedModes[strings.ToLower(strings.TrimSpace(m))] }

Type guard

func isValidTurnProfileMode(m string) bool {
	switch strings.ToLower(strings.TrimSpace(m)) {
	case "default", "off", "custom":
		return true
	}
	return false
}

Try / catch

if err := cfg.Validate(); err != nil {
	var modeErr *config.ValidationError // if defined; else match on "unsupported mode"
	_ = modeErr
	return err
}

Prevention

When it happens

Trigger: `mode: on`, `mode: enabled`, `mode: CUSTOM`, `mode: " off"` (case/whitespace mismatch), or any typo like `mode: defualt` under any turn_profile block (history, system_prompt, skills, tools).

Common situations: Users coming from other tools write `on/off/enabled` instead of `default/off/custom`, or a stray character/space sneaks in during copy-paste. Case sensitivity surprises people (`Custom` vs `custom`).

Related errors


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