medusajs/medusa · warning
Warning: could not read ${tsconfigBasePath}, using default c
Error message
Warning: could not read ${tsconfigBasePath}, using default compiler options What it means
Before creating the TypeScript program, the http-types-generator reads the tsconfig specified in its config to inherit compiler options (paths, target, jsx...). If the tsconfig file cannot be read (missing or unreadable), it warns and falls back to hardcoded defaults (ES2021, Node16...), which may break path alias resolution.
Source
Thrown at packages/cli/http-types-generator/src/core/program-factory.ts:22
import { Config } from "../config"
export interface ProgramContext {
program: ts.Program
checker: ts.TypeChecker
}
export class ProgramFactory {
/**
* Reads and parses the project's TypeScript compiler options from the
* tsconfig file specified in config (defaults to `tsconfig.json`).
*/
private static getBaseCompilerOptions(): ts.CompilerOptions {
const projectRoot = FsHelpers.getProjectRoot()
const tsconfigBasePath = path.join(projectRoot, Config.get().tsconfig)
const configStr = ts.sys.readFile(tsconfigBasePath)
if (!configStr) {
console.warn(
`Warning: could not read ${tsconfigBasePath}, using default compiler options`
)
return {
target: ts.ScriptTarget.ES2021,
module: ts.ModuleKind.Node16,
moduleResolution: ts.ModuleResolutionKind.Node16,
esModuleInterop: true,
skipLibCheck: true,
strictNullChecks: true,
resolveJsonModule: true,
allowJs: true,
}
}
const parsed = ts.parseJsonConfigFileContent(
JSON.parse(configStr),
ts.sys,
projectRootView on GitHub (pinned to 5e06e544a2)
Solutions
- Set the correct tsconfig path in http-types config: { "tsconfig": "./tsconfig.app.json" }
- Verify the path is relative to the project root detected by FsHelpers.getProjectRoot
- Re-run and confirm no warning
Example fix
// before
{ "tsconfig": "tsconfig.json" }
// after
{ "tsconfig": "./tsconfig.app.json" } Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from "fs"
const tsconfig = require("./http-types.config.json").tsconfig ?? "tsconfig.json"
if (!existsSync(tsconfig)) throw new Error(`tsconfig not found: ${tsconfig}`) Prevention
- Point the http-types config's tsconfig at the file that actually configures your app sources
- Verify relative paths resolve from the project root
When it happens
Trigger: Config points to a non-existent tsconfig path, e.g. "tsconfig": "tsconfig.json" when the project uses tsconfig.app.json, or the file lacks read permissions.
Common situations: Running the generator from a workspace root where the relative tsconfig path resolves differently; monorepo setups with nested tsconfigs.
Related errors
- Warning: could not parse ${candidate}, using default config
- ts-node cannot be loaded and used, if you are running in pro
- Failed to setup database; install PostgresQL or make sure to
- Lint produced ${result.warningCount} warning(s).
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/2db7711627080235.
Report an issue: GitHub.