zellij-org/zellij · error
unterminated import statement at {}
Error message
unterminated import statement at {} What it means
A multi-line import statement never found its closing `} from './x.js';` line: the parser consumed every remaining line of the file as import bindings and hit end-of-file with `terminated` still false, so bundling aborts.
Source
Thrown at xtask/src/assets.rs:178
if let Some(rest) = line.strip_prefix("import ") {
if is_terminated_import(rest) {
validate_module_specifier(rest, &location())?;
continue;
}
let mut terminated = false;
for (_, continuation) in lines.by_ref() {
let trimmed = continuation.trim_start();
if trimmed.starts_with("} from ") && trimmed.ends_with(';') {
validate_module_specifier(trimmed, &location())?;
terminated = true;
break;
}
if !is_import_binding_line(trimmed) {
return Err(anyhow!("unrecognised import syntax at {}", location()));
}
}
if !terminated {
return Err(anyhow!("unterminated import statement at {}", location()));
}
continue;
}
if line.starts_with("export ") || line.starts_with("export{") {
if line.starts_with("export {") {
if line.contains(" from ") {
validate_module_specifier(line, &location())?;
continue;
}
return Err(anyhow!("unrecognised export syntax at {}", location()));
}
if line.starts_with("export default") || line.starts_with("export *") {
return Err(anyhow!("unsupported export form at {}", location()));
}
let stripped = &line["export ".len()..];
if !DECLARATION_PREFIXES
.iter()View on GitHub (pinned to 98a0837077)
Solutions
- Restore the closing `} from './name.js';` line of the import block
- Collapse the import to one line so the structure is obvious and cannot dangle
- Check the file named in the error (module.js:line points at the opening `import` line) for conflict markers or truncation
Example fix
// before (file ends without a from-clause)
import {
a,
b,
// after
import {
a,
b,
} from './utils.js'; Defensive patterns
Strategy: validation
Validate before calling
# every 'import {' block must be closed by a '} from "./x.js";' line
python3 - <<'EOF'
import pathlib, re
for p in pathlib.Path('zellij-client/assets').glob('*.js'):
open_import = False
for n, line in enumerate(p.read_text().splitlines(), 1):
if re.match(r'^import .*[^;]$', line): open_import = True
elif open_import and line.rstrip().endswith(';'): open_import = False
if open_import: print(f'{p}:{n}: unterminated import block')
EOF Prevention
- Complete import blocks before saving; let the editor's bracket matching confirm closure
- Avoid splitting imports across merge-conflict regions
- Run `cargo xtask assets` after rebases touching the web client
When it happens
Trigger: Deleting or truncating the `} from ...;` line when editing an import block; a pasted import that got cut off mid-block.
Common situations: Merge conflicts resolved badly inside import blocks; partial pastes; editor auto-removing a line while refactoring imports.
Related errors
- unrecognised import syntax at {}
- missing module specifier at {}
- only relative sibling module specifiers are supported, found
- duplicate top-level identifier '{}' declared in both '{}.js'
- dynamic import is not supported at {}
AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16).
Data as JSON: /api/errors/b73869274ceed8c6.
Report an issue: GitHub.