{"record":{"id":"ac26b5166e80aff4","repo":"sipeed/picoclaw","slug":"turn-profile-s-mode-custom-is-not-supported-in-th","errorCode":null,"errorMessage":"turn_profile.%s.mode custom is not supported in this version","messagePattern":"turn_profile\\.(.+?)\\.mode custom is not supported in this version","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/turn_profile.go","lineNumber":109,"sourceCode":"\tif err := validateTurnProfileBlock(\"skills\", profile.Skills, true); err != nil {\n\t\treturn err\n\t}\n\tif err := validateTurnProfileBlock(\"tools\", profile.Tools, true); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc validateTurnProfileBlock(field string, block TurnProfileBlock, allowCustom bool) error {\n\tmode := block.Mode.Effective()\n\tswitch mode {\n\tcase TurnProfileModeDefault, TurnProfileModeOff:\n\t\treturn nil\n\tcase TurnProfileModeCustom:\n\t\tif allowCustom {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"turn_profile.%s.mode custom is not supported in this version\", field)\n\tdefault:\n\t\treturn fmt.Errorf(\"turn_profile.%s.mode has unsupported mode %q\", field, block.Mode)\n\t}\n}\n\nfunc cleanStringList(values []string) []string {\n\tif len(values) == 0 {\n\t\treturn nil\n\t}\n\tout := make([]string, 0, len(values))\n\tseen := make(map[string]struct{}, len(values))\n\tfor _, value := range values {\n\t\tvalue = strings.TrimSpace(value)\n\t\tif value == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif _, ok := seen[value]; ok {\n\t\t\tcontinue","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/config/turn_profile.go#L91-L127","documentation":"Returned by validateTurnProfileBlock when a turn_profile block's effective mode is `custom` but that block does not allow custom profiles in this build. In the current code only `skills` and `tools` blocks pass allowCustom=true; `history` and `system_prompt` pass false, so `mode: custom` under turn_profile.history or turn_profile.system_prompt is rejected even though the custom mode exists elsewhere.","triggerScenarios":"Config contains `turn_profile:\\n  history:\\n    mode: custom` or `turn_profile:\\n  system_prompt:\\n    mode: custom`. Block.Mode.Effective() resolves to TurnProfileModeCustom, allowCustom is false for those two blocks, and the error fires naming the field.","commonSituations":"Copying a skills/tools-style custom profile into history or system_prompt, or upgrading to a version where custom is gated per-block. Users assume `custom` is universally available because other blocks accept it.","solutions":["Remove `mode: custom` from the history/system_prompt block (let it default) or set an allowed mode","Move the customization you wanted into a block that supports custom (skills, tools)","Upgrade or check release notes if custom history/system_prompt is expected to be supported in a newer build","Re-validate the config after the change"],"exampleFix":"# before\nturn_profile:\n  history:\n    mode: custom\n\n# after\nturn_profile:\n  history:\n    mode: default","handlingStrategy":"validation","validationCode":"// Reject custom mode for blocks that don't allow it, pre-load.\nvar customForbidden = map[string]bool{\"history\": true, \"system_prompt\": true}\nfunc turnProfileModesOK(p TurnProfile) error {\n\tif customForbidden[\"history\"] && p.History.Mode.Effective() == TurnProfileModeCustom {\n\t\treturn fmt.Errorf(\"turn_profile.history: custom not supported\")\n\t}\n\tif customForbidden[\"system_prompt\"] && p.SystemPrompt.Mode.Effective() == TurnProfileModeCustom {\n\t\treturn fmt.Errorf(\"turn_profile.system_prompt: custom not supported\")\n\t}\n\treturn nil\n}","typeGuard":"func allowsCustom(block string) bool {\n\tswitch block {\n\tcase \"skills\", \"tools\":\n\t\treturn true // allowCustom=true at call sites\n\tdefault: // history, system_prompt\n\t\treturn false\n\t}\n}","tryCatchPattern":"if err := cfg.Validate(); err != nil {\n\tif strings.Contains(err.Error(), \"custom is not supported\") {\n\t\t// strip mode: custom from history/system_prompt and retry\n\t}\n\treturn err\n}","preventionTips":["Check which blocks accept custom in current docs before writing custom profiles","Keep custom profiles under skills/tools only","On version bumps, re-validate config and remove newly-gated modes"],"tags":["go","config","validation","turn-profile","version-gating"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}