jdx/mise · error · eyre::Report

unexpected raw Go string delimiter

Error message

unexpected raw Go string delimiter

What it means

After strip_prefix/strip_suffix backticks succeed, parse_argument checks the raw string body for any remaining '`' character; Go raw strings cannot contain a backtick (there is no escape), so an interior delimiter makes the token ambiguous and this error is raised. The outer pair matched, but the content itself contains a stray delimiter.

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 6f52dcdf99)

Solutions

  1. Remove the interior backtick from the path or rename the directory so it contains none
  2. If quoting is needed, use an interpreted string \"...\" — backticks have no escape sequence in raw strings
  3. Double-check pasted entries for markdown formatting characters

Example fix

# before (go.work) — entry copied from markdown with stray backtick
use `api`

# after
use ./api
Defensive patterns

Strategy: validation

Validate before calling

fn raw_string_body_is_clean(token: &str) -> bool {
    match token.strip_prefix('`').and_then(|b| b.strip_suffix('`')) {
        Some(body) => !body.contains('`'),
        None => true,
    }
}

Type guard

fn is_valid_raw_string(token: &str) -> bool {
    match token.strip_prefix('`').and_then(|b| b.strip_suffix('`')) {
        Some(body) => !body.contains('`'),
        None => false,
    }
}

Try / catch

Err(report) if report.to_string().contains("unexpected raw Go string delimiter") => {
    // de-markdown the token: drop every backtick and treat it as a plain path
    let token: String = token.chars().filter(|c| *c != '`').collect();
    directories.push(PathBuf::from(token));
}

Prevention

When it happens

Trigger: An entry like a backtick-wrapped `a`b` where the body contains another backtick (the first and last backticks pair up, leaving `a`b` with an interior delimiter); paths copied from markdown/code spans that carried backticks in.

Common situations: Copy-pasting paths from documentation where backticks were formatting; attempting to quote a path that legitimately contains a backtick character; nested quoting experiments while handling spaces.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/16ddce7754e8c2c0. Report an issue: GitHub.