jdx/mise · error
unterminated interpreted Go string
Error message
unterminated interpreted Go string
What it means
Go interpreted strings must be delimited by matching double quotes. parse_argument accepts an argument starting with `"` only if it also ends with `"`; otherwise it bails with 'unterminated interpreted Go string'. The parser never reads to subsequent lines, so the quote must close on the same line.
Solutions
- Add the missing closing double quote: `use "./dir"`.
- Prefer unquoted relative paths in go.work (`use ./dir`), which need no quoting.
- Regenerate the file (`go work init`, `go mod tidy`) if it is badly corrupted.
Example fix
// before (go.work) use "./services/api // after use "./services/api"
Defensive patterns
Strategy: validation
Validate before calling
// shell: quoted args must have balanced quotes on the same line
grep -nE '(^|[ \t])(use|module)[ \t]+"[^"]*$' go.work go.mod && { echo 'unterminated quoted string'; exit 1; } || true Type guard
fn is_balanced_quoted(s: &str) -> bool { s.starts_with('"') == s.ends_with('"') && s.len() >= 2 } Prevention
- Prefer unquoted relative paths in go.work; quote only when the path contains spaces
- Disable smart-quote substitution in editors for Go metadata files
- After hand edits, run `go work sync` / `go mod tidy` to validate syntax
When it happens
Trigger: A directive argument in go.work or go.mod starts with `"` but the closing `"` is missing on that line, e.g. `use "./dir` or a quoted module path whose trailing quote was deleted.
Common situations: Hand-editing go.mod/go.work and dropping the closing quote; merge conflicts trimming a line; copy-paste truncation; smart-quote editors replacing `"` with typographic quotes.
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 raw 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/f7fd979081d25716.
Report an issue: GitHub.
Appendix: source
Thrown at src/task/workspace/go.rs:185
module_path.ok_or_else(|| eyre::eyre!("Go module metadata is missing a module directive"))
}
fn directive_arguments<'a>(line: &'a str, directive: &str) -> Option<&'a str> {
let rest = line.strip_prefix(directive)?;
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())
}
View on GitHub (pinned to 533346cc37)