oxc-project/oxc · error · anyhow::Error
TS5112
TS5112
Error message
tsconfig.json is present but will not be loaded if files are specified on commandline. Use '--ignoreConfig' to skip this error.
What it means
tsc error TS5058, raised in resolve_config_file when the --project argument resolves (relative to cwd) to neither an existing file nor an existing directory. The path is checked with exists() after the is_dir() branch, so this fires only for a completely missing filesystem path.
Source
Thrown at crates/oxc_type_checker/src/execute/tsc.rs:103
// TS5081
bail!(
"Cannot find a tsconfig.json file at the current directory: {}.",
config_file.display()
);
}
} else if file_or_directory.exists() {
// An explicit config file (need not be named `tsconfig.json`).
Ok(Some(file_or_directory))
} else {
// TS5058
bail!("The specified path does not exist: '{}'.", file_or_directory.display());
}
} else if let Some(config_file) = find_config_file(cwd) {
if command.files.is_empty() {
Ok(Some(config_file))
} else {
// TS5112: a tsconfig.json is present but source files were also specified.
bail!(
"tsconfig.json is present but will not be loaded if files are specified on \
commandline. Use '--ignoreConfig' to skip this error."
);
}
} else if command.files.is_empty() {
// TS5081 — `tsc` prints version + help here; we report the missing config instead.
bail!("Cannot find a tsconfig.json file at the current directory: {}.", cwd.display());
} else {
// Source files with no config file anywhere: compile them directly.
Ok(None)
}
}
/// Search `dir` and its ancestors for a `tsconfig.json`, mirroring tsgo's `findConfigFile`
/// (`tspath.ForEachAncestorDirectory`).
fn find_config_file(dir: &Path) -> Option<PathBuf> {
dir.ancestors()
.map(|ancestor| ancestor.join("tsconfig.json"))View on GitHub (pinned to e1e7af627c)
Solutions
- Verify the path spelling and whether it should be relative to the current working directory or absolute
- Create the missing tsconfig file or directory
- Pass --ignoreConfig if no config file should be loaded
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_type_checker/src/execute/tsc.rs:103 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/093cc6ba21c0cc17.
Report an issue: GitHub.