zellij-org/zellij · error

missing module specifier at {}

Error message

missing module specifier at {}

What it means

validate_module_specifier extracts the module path with `rsplit_once(" from ")` from a line that reached specifier validation. If the line contains no ' from ' separator, no specifier can be located and bundling aborts.

Source

Thrown at xtask/src/assets.rs:231

fn is_terminated_import(rest: &str) -> bool {
    rest.ends_with(';') && rest.contains(" from ")
}

fn is_import_binding_line(trimmed: &str) -> bool {
    if trimmed.is_empty() || trimmed == "{" {
        return true;
    }
    trimmed
        .trim_end_matches(',')
        .chars()
        .all(|c| c.is_alphanumeric() || c == '_' || c == '$' || c == ' ')
}

fn validate_module_specifier(line: &str, location: &str) -> anyhow::Result<()> {
    let specifier = line
        .rsplit_once(" from ")
        .map(|(_, specifier)| specifier)
        .ok_or_else(|| anyhow!("missing module specifier at {}", location))?
        .trim()
        .trim_end_matches(';')
        .trim_matches(|c| c == '"' || c == '\'');

    let name = specifier
        .strip_prefix("./")
        .and_then(|name| name.strip_suffix(".js"))
        .ok_or_else(|| {
            anyhow!(
                "only relative sibling module specifiers are supported, found '{}' at {}",
                specifier,
                location
            )
        })?;

    if !MODULE_ORDER.contains(&name) {
        return Err(anyhow!(
            "module '{}' referenced at {} is not part of the bundle",

View on GitHub (pinned to 98a0837077)

Solutions

  1. Give the statement a full specifier: `import { a } from './utils.js';`
  2. Replace side-effect imports with a normal named import from that module (or drop them: the bundle is one file)
  3. Fix the truncated line identified by the module.js:line location in the message

Example fix

// before (rejected: no ' from ')
import './utils.js';

// after
import { bootstrap } from './utils.js';
Defensive patterns

Strategy: validation

Validate before calling

# every import/export-from line must contain a ' from ' clause with a path
grep -nE '^(import|export)' zellij-client/assets/*.js | grep -v ' from ' && {
  echo 'import/export statement missing from-clause'; exit 1;
} || true

Type guard

fn has_module_specifier(line: &str) -> bool {
    line.rsplit_once(" from ").is_some()
}

Prevention

When it happens

Trigger: A side-effect import `import './utils.js';`; a re-export whose path was deleted (`export { a } from;`); an import line truncated so the from-clause is missing.

Common situations: Half-edited import/export lines after refactors or merge conflicts; scripts pasted without their from-clause.

Related errors


AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16). Data as JSON: /api/errors/48854983c3d11d2c. Report an issue: GitHub.