{"record":{"id":"49b9646b3af12c90","repo":"jdx/mise","slug":"unexpected-interpreted-go-string-delimiter","errorCode":null,"errorMessage":"unexpected interpreted Go string delimiter","messagePattern":"unexpected interpreted Go string delimiter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/workspace/go.rs","lineNumber":209,"sourceCode":"            bail!(\"unterminated raw Go string\");\n        };\n        if value.contains('`') {\n            bail!(\"unexpected raw Go string delimiter\");\n        }\n        return Ok(value.to_string());\n    }\n    if value.split_whitespace().count() != 1 {\n        bail!(\"directive requires exactly one argument\");\n    }\n    Ok(value.to_string())\n}\n\nfn unescape_go_string(value: &str) -> Result<String> {\n    let mut characters = value.chars();\n    let mut unescaped = String::new();\n    while let Some(character) = characters.next() {\n        if character == '\"' {\n            bail!(\"unexpected interpreted Go string delimiter\");\n        }\n        if character != '\\\\' {\n            unescaped.push(character);\n            continue;\n        }\n        let escape = characters\n            .next()\n            .ok_or_else(|| eyre::eyre!(\"unterminated Go string escape\"))?;\n        let escaped = match escape {\n            'a' => '\\u{0007}',\n            'b' => '\\u{0008}',\n            'f' => '\\u{000c}',\n            'n' => '\\n',\n            'r' => '\\r',\n            't' => '\\t',\n            'v' => '\\u{000b}',\n            '\\\\' => '\\\\',\n            '\\'' => '\\'',","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/workspace/go.rs#L191-L227","documentation":"When parsing a Go interpreted (double-quoted) string literal for task arguments, mise's unescape_go_string walks the characters after stripping the delimiters. A raw '\"' inside the content means the string was not actually a single well-formed literal (embedded delimiter), so parsing bails. This guards the workspace Go task argument parser from treating malformed literals as valid strings.","triggerScenarios":"Calling parse_argument with a value like `\"a\"b\"` where an unescaped double quote appears inside a Go interpreted string literal.","commonSituations":"Hand-written mise.toml task args quoting Go string literals incorrectly; copy-pasted Go snippets where inner quotes were not escaped with \\\"; tooling that generated the literal without escaping.","solutions":["Escape the inner double quote as \\\" inside the Go interpreted string literal.","Split the value into multiple concatenated literals: \"a\" + \"b\".","Use a Go raw string literal with backticks (`a\"b`) if no escapes are needed."],"exampleFix":"// before\nargs = [\"\\\"hello\\\" world\\\"\"]  // literal: \"hello\" world\"\n// after\nargs = [\"\\\"hello world\\\"\"]    // literal: \"hello world\"","handlingStrategy":"validation","validationCode":"function validateGoInterpretedLiteral(raw) {\n  const inner = raw.slice(1, -1); // strip surrounding quotes\n  if (/(?<!\\\\)\"/.test(inner)) throw new Error('unescaped \" inside Go string literal');\n  return true;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always escape inner double quotes as \\\" in Go interpreted strings.","Prefer raw strings (backticks) when the literal contains quotes and needs no escapes."],"tags":["go","parsing","task-arguments","string-escaping"],"backgroundTag":"invalid-argument-format","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}