oxc-project/oxc · error · OxcDiagnostic

named import {imported_name:?} not found

Error message

named import {imported_name:?} not found

What it means

Fires from import/named when a named import specifier cannot be found in the resolved module's export record. The diagnostic is built in named_diagnostic with a help asking whether the source module actually exports that name; the module record for the imported file lacks the requested named export.

Source

Thrown at crates/oxc_linter/src/rules/import/named.rs:12

use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;

use crate::{
    context::LintContext,
    module_record::{ExportEntry, ExportImportName, ImportImportName, ModuleRecord, NameSpan},
    rule::Rule,
};

fn named_diagnostic(imported_name: &str, module_name: &str, span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn(format!("named import {imported_name:?} not found"))
        .with_help(format!("Does {module_name:?} have the export {imported_name:?}?"))
        .with_label(span)
}

fn has_default_export(module_record: &ModuleRecord) -> bool {
    module_record.export_default.is_some()
        || module_record.exported_bindings.contains_key("default")
}

fn is_synthesized_indirect_export_entry(export_entry: &ExportEntry) -> bool {
    !export_entry.statement_span.contains_inclusive(export_entry.span)
}

fn is_reexport_of_default_import(
    module_record: &ModuleRecord,
    export_entry: &ExportEntry,
    import_name: &NameSpan,
    remote_module_record: &ModuleRecord,

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Fix the typo in the imported name
  2. Import the name that the module actually exports
  3. Add the missing export to the source module
  4. Use the default import if that is what the module provides
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/import/named.rs:12 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/0b9ea10e9d919bc0. Report an issue: GitHub.