jdx/mise · error

unexpected raw Go string delimiter

Error message

unexpected raw Go string delimiter

What it means

After a raw Go string opens with a backtick and closes, parse_argument rejects a value that still contains another backtick inside, bailing with 'unexpected raw Go string delimiter'. Go raw strings cannot contain backticks, and a stray one would make the argument ambiguous.

Solutions

  1. Remove the interior backtick from the path/value.
  2. Use double quotes (interpreted string) with escape sequences instead, or an unquoted plain token.
  3. If the path genuinely needs a backtick, rename the directory — Go tooling cannot represent it in raw strings either.

Example fix

// before (go.work)
use `./`weird`dir`

// after
use "./`weird`dir" // rename instead: use ./weird-dir
Defensive patterns

Strategy: validation

Validate before calling

// shell: raw strings must contain exactly two backticks on the line
grep -n '`' go.work go.mod | awk -F'`' 'NF!=3 {print "bad raw string: " $0; bad=1} END{exit bad}'

Type guard

fn is_clean_raw(s: &str) -> bool { !s.starts_with('`') || (s.matches('`').count() == 2) }

Prevention

When it happens

Trigger: A backtick-quoted directive argument in go.work/go.mod contains an inner backtick, e.g. `` use `./a`b` `` — the parser matches the first pair of backticks, finds a leftover one, and fails.

Common situations: Copy-pasting paths that include backticks (e.g. from markdown or shell command substitution syntax) into go.work/go.mod; a templating script injecting unescaped backticks.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/16ddce7754e8c2c0. Report an issue: GitHub.

Appendix: source

Thrown at src/task/workspace/go.rs:194

    Some(rest.trim())
}

fn parse_argument(value: &str) -> Result<String> {
    if value.is_empty() {
        bail!("directive requires one argument");
    }
    if let Some(value) = value.strip_prefix('"') {
        let Some(value) = value.strip_suffix('"') else {
            bail!("unterminated interpreted Go string");
        };
        return unescape_go_string(value);
    }
    if let Some(value) = value.strip_prefix('`') {
        let Some(value) = value.strip_suffix('`') else {
            bail!("unterminated raw Go string");
        };
        if value.contains('`') {
            bail!("unexpected raw Go string delimiter");
        }
        return Ok(value.to_string());
    }
    if value.split_whitespace().count() != 1 {
        bail!("directive requires exactly one argument");
    }
    Ok(value.to_string())
}

fn unescape_go_string(value: &str) -> Result<String> {
    let mut characters = value.chars();
    let mut unescaped = String::new();
    while let Some(character) = characters.next() {
        if character == '"' {
            bail!("unexpected interpreted Go string delimiter");
        }
        if character != '\\' {
            unescaped.push(character);

View on GitHub (pinned to 533346cc37)