{"record":{"id":"9c21d76bfb82b023","repo":"sipeed/picoclaw","slug":"invalid-header-q-expected-name-value-or-name","errorCode":null,"errorMessage":"invalid header %q: expected 'Name: Value' or 'Name=Value'","messagePattern":"invalid header %q: expected 'Name: Value' or 'Name=Value'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/picoclaw/internal/mcp/helpers.go","lineNumber":246,"sourceCode":"\t\tenv[key] = value\n\t}\n\n\treturn env, nil\n}\n\nfunc parseHeaderAssignments(values []string) (map[string]string, error) {\n\tif len(values) == 0 {\n\t\treturn nil, nil\n\t}\n\n\theaders := make(map[string]string, len(values))\n\tfor _, entry := range values {\n\t\tkey, value, found := strings.Cut(entry, \":\")\n\t\tif !found {\n\t\t\tkey, value, found = strings.Cut(entry, \"=\")\n\t\t}\n\t\tif !found {\n\t\t\treturn nil, fmt.Errorf(\"invalid header %q: expected 'Name: Value' or 'Name=Value'\", entry)\n\t\t}\n\t\tkey = strings.TrimSpace(key)\n\t\tvalue = strings.TrimSpace(value)\n\t\tif key == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"invalid header %q: name cannot be empty\", entry)\n\t\t}\n\t\theaders[key] = value\n\t}\n\n\treturn headers, nil\n}\n\nfunc looksLikeRemoteURL(target string) bool {\n\tparsedURL, err := url.ParseRequestURI(target)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif parsedURL.Host == \"\" {","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/mcp/helpers.go#L228-L264","documentation":"parseHeaderAssignments (helpers.go:234-257) accepts either 'Name: Value' or 'Name=Value'; it tries ':' first, falls back to '=', and a -H/--header value containing neither separator is rejected with this message. Both forms are trimmed, so extra whitespace around the separator is fine.","triggerScenarios":"`-H X-API-Key` alone (no separator); quoting that consumed the colon; pasting only the header name when meaning to add it to a request template.","commonSituations":"Habit from tools where the header name alone toggles something; YAML/shell mangles ': ' inside unquoted values.","solutions":["Use 'Name: Value' form: -H \"Authorization: Bearer <token>\"","Quote the entire flag value in the shell so the colon/space survive intact"],"exampleFix":"# before\npicoclaw mcp add s https://api/x --transport http -H X-API-Key\n# after\npicoclaw mcp add s https://api/x --transport http -H \"X-API-Key: abc123\"","handlingStrategy":"validation","validationCode":"for h in \"${HEADERS[@]}\"; do\n  case \"$h\" in\n    *:*=*|*:*|*=*) ;;   # contains ':' or '='\n    *) echo \"invalid header '$h': expected 'Name: Value' or 'Name=Value'\" >&2; exit 2 ;;\n  esac\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on 'Name: Value' form for headers","Quote the whole -H argument so separators survive shell parsing"],"tags":["cli","flags","http","headers"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}