{"record":{"id":"aeefc2d63fbc3160","repo":"thedotmack/claude-mem","slug":"invalid-mode-inheritance-modeid-only-one-leve","errorCode":null,"errorMessage":"Invalid mode inheritance: ${modeId}. Only one level of inheritance supported (parent--override)","messagePattern":"Invalid mode inheritance: (.+?)\\. Only one level of inheritance supported \\(parent--override\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/services/domain/ModeManager.ts","lineNumber":48,"sourceCode":"    if (!ModeManager.instance) {\n      ModeManager.instance = new ModeManager();\n    }\n    return ModeManager.instance;\n  }\n\n  private parseInheritance(modeId: string): {\n    hasParent: boolean;\n    parentId: string;\n    overrideId: string;\n  } {\n    const parts = modeId.split('--');\n\n    if (parts.length === 1) {\n      return { hasParent: false, parentId: '', overrideId: '' };\n    }\n\n    if (parts.length > 2) {\n      throw new Error(\n        `Invalid mode inheritance: ${modeId}. Only one level of inheritance supported (parent--override)`\n      );\n    }\n\n    return {\n      hasParent: true,\n      parentId: parts[0],\n      overrideId: modeId \n    };\n  }\n\n  private isPlainObject(value: unknown): boolean {\n    return (\n      value !== null &&\n      typeof value === 'object' &&\n      !Array.isArray(value)\n    );\n  }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/services/domain/ModeManager.ts#L30-L66","documentation":"Thrown by ModeManager.parseInheritance() when a mode id contains more than one '--' separator. The mode system supports exactly one level of inheritance expressed as 'parent--override'; splitting on '--' must yield at most two parts. Three or more parts (e.g. 'a--b--c') is rejected.","triggerScenarios":"Passing a mode id like 'code--review--strict' to loadMode(); chaining overrides thinking inheritance is transitive; a generated mode id concatenates two override suffixes.","commonSituations":"User creates a custom override of an override; tooling builds mode ids by joining multiple segments with '--'; misunderstanding that the override is the full 'parent--override' id, not a third segment.","solutions":["Use a single inheritance level: 'parent--override' only. If you need deeper customization, edit the override JSON to deep-merge what you need rather than chaining.","If you have 'a--b--c', flatten by making a single override file 'a--bplusc' that combines b and c's deltas.","Validate mode ids against the pattern before calling loadMode."],"exampleFix":"// before\nmanager.loadMode('code--review--strict');\n// throws 'Invalid mode inheritance: code--review--strict...'\n\n// after — one level only, with the override JSON merging both deltas\nmanager.loadMode('code--review');\n// where modes/code--review.json contains the merged review+strict overrides","handlingStrategy":"validation","validationCode":"function isValidInheritance(modeId: string): boolean {\n  return modeId.split('--').length <= 2;\n}","typeGuard":"function isSingleLevelInheritance(modeId: string): boolean {\n  return modeId.split('--').length <= 2 && /^[a-z0-9]+(?:-[a-z0-9]+)*(?:--[a-z0-9]+(?:-[a-z0-9]+)*)?$/.test(modeId);\n}","tryCatchPattern":null,"preventionTips":["Never chain '--' more than once; edit the override JSON to combine deltas instead.","Validate mode ids against MODE_ID_PATTERN before calling loadMode.","Remember the override id is the whole 'parent--override' string, not a third segment."],"tags":["modes","validation","config"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}