jdx/mise · error
incomplete Go string escape
Error message
incomplete Go string escape
What it means
escape_character reads a fixed number of digits (octal/hex/unicode escapes) from the char stream. If the string ends before the expected count is collected, the escape is truncated and mise bails rather than decoding partial data. This prevents silently mis-decoding truncated literals.
Solutions
- Supply the full digit count the escape requires (e.g. \x0041 not \x41... complete both hex digits).
- Zero-pad short escapes: \u0041 instead of \u41.
- Check the config file wasn't truncated or cut off at the end of the literal.
Example fix
// before args = ["\u00e9"] // 4 digits: valid — vs "\u0e9" invalid // after args = ["\u00e9"] // ensure all 4 hex digits present
Defensive patterns
Strategy: validation
Validate before calling
function escapeComplete(inner, idx) {
// ensure \x has 2 hex digits, \u 4, \U 8, octal 3
return inner.length >= idx + 2; // caller supplies required length
} Prevention
- Zero-pad short escapes (\u0041 not \u41).
- Avoid letting templating/interpolation consume digits intended for escapes.
When it happens
Trigger: A Go interpreted string literal ends mid-escape, e.g. "\x4" or "\u00" — fewer digits than the escape requires (3 octal, 2 hex, 4/8 unicode).
Common situations: Manually edited task args where trailing digits were deleted; template/interpolation consuming some of the escape digits; truncated config file.
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
- unexpected interpreted Go string delimiter
- unsupported Go string escape \
- additional_artifacts must be an array in lockfile
- directive requires exactly one argument
- directive requires one argument
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/001c2681169f2c4f.
Report an issue: GitHub.
Appendix: source
Thrown at src/task/workspace/go.rs:257
);
}
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)
}
fn decoded_character(digits: &str, radix: u32) -> Result<char> {
let value = u32::from_str_radix(digits, radix)
.wrap_err_with(|| format!("invalid Go string escape {digits:?}"))?;
char::from_u32(value).ok_or_else(|| eyre::eyre!("invalid Go character escape {digits:?}"))
}
fn strip_comment(line: &str) -> &str {
let mut quote = None;
let mut escaped = false;
for (index, character) in line.char_indices() {
match quote {
Some('"') if escaped => escaped = false,
Some('"') if character == '\\' => escaped = true,
Some(delimiter) if character == delimiter => quote = None,View on GitHub (pinned to 533346cc37)