{"record":{"id":"a6143ba93ac0cf44","repo":"jdx/mise","slug":"unsupported-go-string-escape-escape-a6143b","errorCode":null,"errorMessage":"unsupported Go string escape \\{escape}","messagePattern":"unsupported Go string escape \\\\(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/workspace/go.rs","lineNumber":243,"sourceCode":"            'v' => '\\u{000b}',\n            '\\\\' => '\\\\',\n            '\\'' => '\\'',\n            '\"' => '\"',\n            'x' => escape_character(&mut characters, 2, 16)?,\n            'u' => escape_character(&mut characters, 4, 16)?,\n            'U' => escape_character(&mut characters, 8, 16)?,\n            digit @ '0'..='7' => {\n                let mut digits = digit.to_string();\n                for _ in 0..2 {\n                    digits.push(\n                        characters\n                            .next()\n                            .ok_or_else(|| eyre::eyre!(\"incomplete octal Go string escape\"))?,\n                    );\n                }\n                decoded_character(&digits, 8)?\n            }\n            _ => bail!(\"unsupported Go string escape \\\\{escape}\"),\n        };\n        unescaped.push(escaped);\n    }\n    Ok(unescaped)\n}\n\nfn escape_character(\n    characters: &mut std::str::Chars<'_>,\n    length: usize,\n    radix: u32,\n) -> Result<char> {\n    let digits = characters.take(length).collect::<String>();\n    if digits.chars().count() != length {\n        bail!(\"incomplete Go string escape\");\n    }\n    decoded_character(&digits, radix)\n}\n","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/task/workspace/go.rs#L225-L261","documentation":"When unescaping an interpreted Go string, `unescape_go_string` matches the character after a backslash against the supported escape set (a, b, f, n, r, t, v, \\\\, \\\", octal, hex \\x, and unicode \\u/\\U). Any other escape sequence throws this error naming the offending escape character.","triggerScenarios":"A directive argument string containing an escape like `\\q`, `\\e`, `\\/`, or `\\0x` — i.e. a backslash followed by a character not in Go's escape table.","commonSituations":"Inventing escapes that other languages (JS, JSON) allow but Go does not; accidentally backslash-escaping a normal character; copy-pasting paths with stray backslashes.","solutions":["Remove the unnecessary backslash (most characters do not need escaping in Go strings)","Replace the sequence with a supported Go escape (\\n, \\t, \\\\, \\x41, \\u0041, ...)","Use a raw backtick string where escapes are not interpreted"],"exampleFix":"// before\nmodule \"exa\\qmple\"\n// after\nmodule \"example\"\n","handlingStrategy":"validation","validationCode":"const GO_ESCAPES: [char; 11] = ['a','b','f','n','r','t','v','\\\\','\"','\\'','0'];\nfn validate_escapes(inner: &str) -> Result<()> {\n    let mut chars = inner.chars();\n    while let Some(c) = chars.next() {\n        if c == '\\\\' {\n            let e = chars.next().context(\"trailing backslash\")?;\n            anyhow::ensure!(GO_ESCAPES.contains(&e) || e.is_ascii_digit() || e == 'x' || e == 'u' || e == 'U', \"unsupported escape \\\\{e}\");\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use Go's documented escape sequences","Remove needless backslashes — most characters need none","Test unusual values against `go vet`/`gofmt` behavior"],"tags":["parsing","go","strings","escaping"],"backgroundTag":"invalid-argument-format","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}