thedotmack/claude-mem · warning

Invalid override file: ${overrideId}, using parent mode '${p

Error message

Invalid override file: ${overrideId}, using parent mode '${parentId}' only

What it means

loadModeFile(overrideId) can return without throwing yet produce a falsy value — typically an empty or unusable document. This warning catches that case and again falls back to the parent mode only. It differs from the 'not found' warnings: the file was reachable and did not fail a parse, but it evaluated to nothing usable as a ModeConfig.

Source

Thrown at src/services/domain/ModeManager.ts:157

      parentMode = this.loadMode('code');
    }

    let overrideConfig: Partial<ModeConfig>;
    try {
      overrideConfig = this.loadModeFile(overrideId);
      logger.debug('SYSTEM', `Loaded override file: ${overrideId} for parent ${parentId}`);
    } catch (error) {
      if (error instanceof Error) {
        logger.warn('WORKER', `Override file '${overrideId}' not found, using parent mode '${parentId}' only`, { message: error.message });
      } else {
        logger.warn('WORKER', `Override file '${overrideId}' not found, using parent mode '${parentId}' only`, { error: String(error) });
      }
      this.activeMode = parentMode;
      return parentMode;
    }

    if (!overrideConfig) {
      logger.warn('SYSTEM', `Invalid override file: ${overrideId}, using parent mode '${parentId}' only`);
      this.activeMode = parentMode;
      return parentMode;
    }

    const mergedMode = this.deepMerge(parentMode, overrideConfig);
    this.activeMode = mergedMode;
    this.activeModeId = modeId;

    logger.debug('SYSTEM', `Loaded mode with inheritance: ${mergedMode.name} (${modeId} = ${parentId} + ${overrideId})`, undefined, {
      parent: parentId,
      override: overrideId,
      types: mergedMode.observation_types.map(t => t.id),
      concepts: mergedMode.observation_concepts.map(c => c.id)
    });

    return mergedMode;
  }

View on GitHub (pinned to e2d1df569a)

Solutions

  1. Open the override file and confirm it contains a non-empty, valid config document.
  2. If emptiness was intentional, delete the file and remove the inheritance.overrideId reference instead of keeping an empty file.
  3. Write minimal valid content (an object with the keys you mean to override) and re-activate the mode.
  4. Recognize this specific message: it means the file was read but evaluated falsy — not a read or parse exception.

Example fix

// override file my-override.json — before (empty)

// after (minimal valid override)
{ "name": "code + my tweaks" }
Defensive patterns

Strategy: validation

Validate before calling

// reject empty override documents before they reach ModeManager
const raw = readFileSync(overridePath, 'utf-8').trim();
if (raw.length === 0) throw new Error(`override file is empty: ${overridePath}`);
const parsed: unknown = JSON.parse(raw);

Type guard

function isUsableOverrideDoc(v: unknown): v is Record<string, unknown> {
  return typeof v === 'object' && v !== null && Object.keys(v).length > 0;
}

Prevention

When it happens

Trigger: The override file exists and reads fine but is empty (0 bytes), whitespace-only, or its content maps to null/undefined in the loader (e.g. an empty document the loader normalizes away).

Common situations: Empty override file left by an editor 'new file' action; template never filled in; file truncated to zero bytes by a disk-full condition during an earlier save; misnamed empty placeholder.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@e2d1df569a (2026-08-20). Data as JSON: /api/errors/e0d7b57230421287. Report an issue: GitHub.