{"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/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/services/domain/ModeManager.ts#L30-L66","documentation":"ModeManager.parseInheritance parses mode IDs of the form `parent--override` to support exactly one level of inheritance. If the mode ID contains more than one `--` separator (3+ parts), it cannot be represented and the manager throws this error. One-level inheritance is a hard design constraint of the mode system.","triggerScenarios":"Requesting or loading a mode whose ID contains two or more `--` sequences, e.g. `architect--strict--v2`, typically via loadMode()/mode() with a hand-written mode ID or a mode file named with extra `--`.","commonSituations":"Users inventing deeper inheritance chains (`a--b--c`) assuming nesting is supported; filenames copied from another project that used multi-level naming; concatenating override suffixes programmatically.","solutions":["Use a mode ID with at most one `--` separator, e.g. `code--strict`.","Flatten the desired 3-level config into a single override file that already contains the merged settings.","Rename the mode file to remove extra `--` separators.","If deeper inheritance is needed, chain manually: load parent via loadMode and merge yourself."],"exampleFix":"// before\nawait modeManager.loadMode('architect--strict--v2');\n// after\nawait modeManager.loadMode('architect--strict'); // or merge architect + strict-v2 into one file","handlingStrategy":"validation","validationCode":"const parts = modeId.split('--');\nif (parts.length > 2) throw new Error(`Mode id '${modeId}' has ${parts.length - 1} inheritance levels; max 1`);","typeGuard":"const isValidModeId = (id: string): boolean => /^[a-z0-9]+(--[a-z0-9]+)?$/.test(id);","tryCatchPattern":"try { await manager.loadMode(modeId); } catch (e) { if (e.message.includes('Invalid mode inheritance')) throw new Error(`Flatten '${modeId}' to parent--override form`); throw e; }","preventionTips":["Treat `--` as reserved for exactly one inheritance level in mode naming.","Document mode naming conventions for users creating custom modes.","Merge deep chains into a single override file ahead of time.","Validate mode IDs at config-load time, not deep in runtime calls."],"tags":["mode-manager","inheritance","identifier-format"],"backgroundTag":"invalid-argument-format","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}