jdx/mise · error

unsupported Go string escape \

Error message

unsupported Go string escape \{escape}

What it means

unescape_go_string only supports Go's documented escape sequences (\a \b \f \n \r \t \v \\ \" octal, hex, and unicode forms). Any other backslash-introduced character falls through to this bail. It surfaces when the task argument contains a backslash escape Go itself would reject.

Solutions

  1. Use a supported escape: double the backslash (\\) for a literal backslash.
  2. Correct the typo to a valid Go escape sequence (e.g. \n, \t, \x41).
  3. Switch to a Go raw string (backticks) to avoid escapes entirely.

Example fix

// before
args = ["C:\Users\test"]
// after
args = ["C:\\Users\\test"]
Defensive patterns

Strategy: validation

Validate before calling

const VALID = /^[abfnrtv\\'"xuU0-7]$/;
function validateEscapes(inner) {
  for (let i = 0; i < inner.length; i++) {
    if (inner[i] === '\\' && !VALID.test(inner[i + 1] ?? '')) return false;
  }
  return true;
}

Prevention

When it happens

Trigger: parse_argument receives a Go interpreted string literal containing an escape like \q, \e, \z, or a stray backslash before an ordinary character.

Common situations: Windows-style paths written as "C:\Users\x" inside a Go-style literal; regex patterns with backslashes pasted into task args; typos such as \<space>.

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/a6143ba93ac0cf44. Report an issue: GitHub.

Appendix: source

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

            'v' => '\u{000b}',
            '\\' => '\\',
            '\'' => '\'',
            '"' => '"',
            'x' => escape_character(&mut characters, 2, 16)?,
            'u' => escape_character(&mut characters, 4, 16)?,
            'U' => escape_character(&mut characters, 8, 16)?,
            digit @ '0'..='7' => {
                let mut digits = digit.to_string();
                for _ in 0..2 {
                    digits.push(
                        characters
                            .next()
                            .ok_or_else(|| eyre::eyre!("incomplete octal Go string escape"))?,
                    );
                }
                decoded_character(&digits, 8)?
            }
            _ => bail!("unsupported Go string escape \\{escape}"),
        };
        unescaped.push(escaped);
    }
    Ok(unescaped)
}

fn escape_character(
    characters: &mut std::str::Chars<'_>,
    length: usize,
    radix: u32,
) -> Result<char> {
    let digits = characters.take(length).collect::<String>();
    if digits.chars().count() != length {
        bail!("incomplete Go string escape");
    }
    decoded_character(&digits, radix)
}

View on GitHub (pinned to 533346cc37)