jdx/mise · error
unterminated raw Go string
Error message
unterminated raw Go string
What it means
Go raw strings are delimited by backticks with no escapes. parse_argument accepts a backtick-prefixed argument only if a matching backtick closes it on the same line; otherwise it bails with 'unterminated raw Go string'.
Solutions
- Close the raw string with a second backtick: `use `./dir`.
- Simpler: drop the backticks and use a plain unquoted path or double quotes.
- Regenerate go.work/go.mod with the go tool if corrupted.
Example fix
// before (go.work) use `./services/api // after use `./services/api`
Defensive patterns
Strategy: validation
Validate before calling
// shell
grep -nE '\`[^\`]*$' go.work go.mod && { echo 'unterminated raw string'; exit 1; } || true Type guard
fn is_closed_raw(s: &str) -> bool { !s.starts_with('`') || (s.len() >= 2 && s.ends_with('`')) } Prevention
- Use double quotes, not backticks, for go.work/go.mod string arguments
- Backtick-quote only single-line values and count both delimiters
- Validate with `go work sync` after edits
When it happens
Trigger: A directive argument in go.work/go.mod starts with a backtick (`` ` ``) but no second backtick appears on the same line, e.g. ``use `./dir``.
Common situations: Using backticks instead of double quotes by habit (backtick quoting is rarely needed for paths); an editor or shell snippet stripping a backtick; mixing quote styles across a hand-edited file.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- unexpected raw Go string delimiter
- unterminated interpreted Go string
- directive requires exactly one argument
- directive requires one argument
- Go module metadata contains multiple module directives
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/9f81c78d440abd7b.
Report an issue: GitHub.
Appendix: source
Thrown at src/task/workspace/go.rs:191
if !rest.starts_with(char::is_whitespace) {
return None;
}
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");View on GitHub (pinned to 533346cc37)