windmill-labs/windmill · warning
${existingName} couldn't be auto-edited (it may contain comm
Error message
${existingName} couldn't be auto-edited (it may contain comments). Add ${opts.hint} to pick up wmill's recommended settings (incl. workspace /f/, /u/ import resolution). What it means
ensureUserReferencesManaged (called from refreshManagedTsconfig / refreshManagedDenoImportMap) only rewrites tsconfig.json (or the Deno import map) it can round-trip as plain JSON. Files containing comments (JSONC) fail JSON.parse, so instead of corrupting them wmill warns and skips the edit, telling you the setting to add manually via opts.hint.
Source
Thrown at cli/src/commands/refresh/tsconfig.ts:352
try {
text = readFileSync(existing, "utf-8");
} catch {
return;
}
if (text.includes(opts.token)) {
log.info(
colors.gray(`${existingName} already references ${opts.token}, leaving it untouched`)
);
return;
}
// We only ever rewrite a config we can round-trip as JSON. Files with comments
// (JSONC) fail JSON.parse, so we warn instead of corrupting them.
let parsed: Record<string, unknown>;
try {
parsed = JSON.parse(text);
} catch {
log.warn(
`${existingName} couldn't be auto-edited (it may contain comments). Add ${opts.hint} ` +
`to pick up wmill's recommended settings (incl. workspace /f/, /u/ import resolution).`
);
return;
}
// The file is still exactly what a previous CLI generated → it's ours, so
// migrate it to the new split (replace with the thin stub that extends the
// managed file). No prompt: we're not touching user-authored content.
if (opts.legacyFormats?.some((fmt) => deepEqual(parsed, fmt))) {
writeFileSync(existing, JSON.stringify(opts.create, null, 2) + "\n");
log.info(
colors.green(
`Migrated previously-generated ${existingName} to reference ${opts.token}`
)
);
return;
}View on GitHub (pinned to e474e8803c)
Solutions
- Remove all // and /* */ comments (and trailing commas) from the config file so it is valid JSON, then rerun wmill refresh.
- Apply the setting named in opts.hint manually to the file (it enables wmill's recommended settings incl. workspace /f/, /u/ import resolution).
- Let wmill recreate the file: move the old one aside and rerun refresh so it writes a managed version.
- Keep future edits JSON-only in files managed by wmill, or maintain comments in a separate doc.
Example fix
// before: tsconfig.json
{
// my note
"compilerOptions": { ... }
}
// after
{
"compilerOptions": { ... }
} Defensive patterns
Strategy: validation
Validate before calling
// verify the config is strict JSON before running wmill refresh
import { readFileSync } from 'fs';
try {
JSON.parse(readFileSync('tsconfig.json', 'utf-8'));
console.log('tsconfig.json is valid JSON — refresh can manage it');
} catch (e) {
console.error('tsconfig.json is JSONC/invalid:', e.message);
} Type guard
function isPlainJson(text) { try { JSON.parse(text); return true; } catch { return false; } } Prevention
- Keep wmill-managed config files strict JSON (no comments, no trailing commas).
- Move explanatory comments to a README beside the config.
- Run the JSON.parse check above before each wmill refresh.
- If a JSONC file is required, apply the hint's settings manually and accept the skip.
When it happens
Trigger: Running `wmill refresh` (managed tsconfig/import-map refresh) when the existing tsconfig.json or deno import map contains comments or trailing commas, so JSON.parse throws.
Common situations: Hand-edited tsconfig with // comments (common in editors that tolerate JSONC); a tool-generated config with comments; configs copied from templates that use JSONC syntax.
Related errors
- ${existingName}: ${wired}. Add ${opts.hint} manually to pick
- No instance found, please add one first
- No local instance profile named ${instanceName}
- No active instance. Run 'wmill instance add' or pass --insta
- Active instance ${activeName} not found in config
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/8ffc318bb9da9447.
Report an issue: GitHub.