{"record":{"id":"50b9063f5bb284a2","repo":"discourse/discourse","slug":"blocks-unknown-debug-callback-key-key-val","errorCode":null,"errorMessage":"[Blocks] Unknown debug callback key: \"${key}\". Valid keys are: ${validKeys}.","messagePattern":"\\[Blocks\\] Unknown debug callback key: \"(.+?)\"\\. Valid keys are: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/discourse/app/lib/blocks/-internals/debug-hooks.ts","lineNumber":100,"sourceCode":"   * @param key - The callback key (use DEBUG_CALLBACK constants).\n   * @returns The callback function, or null/undefined if not set.\n   */\n  getCallback(key: string): DebugCallback | null | undefined {\n    return this.#callbacks.get(key);\n  }\n\n  /**\n   * Sets a debug callback in the registry.\n   * Used by dev-tools to register debug hooks.\n   *\n   * @param key - The callback key (use DEBUG_CALLBACK constants).\n   * @param value - The callback function, or null to clear.\n   * @throws If the key is not a valid callback key.\n   */\n  setCallback(key: string, value: DebugCallback | null): void {\n    if (!this.#callbacks.has(key)) {\n      const validKeys = Object.values(DEBUG_CALLBACK).join(\", \");\n      throw new Error(\n        `[Blocks] Unknown debug callback key: \"${key}\". Valid keys are: ${validKeys}.`\n      );\n    }\n    this.#callbacks.set(key, value);\n  }\n\n  /**\n   * Returns whether console logging is enabled.\n   * Convenience getter that invokes the blockLogging callback.\n   *\n   * @returns True if logging is enabled.\n   */\n  get isBlockLoggingEnabled(): boolean {\n    return (\n      (this.#callbacks.get(DEBUG_CALLBACK.BLOCK_LOGGING)?.() as\n        | boolean\n        | undefined) ?? false\n    );","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/discourse/discourse/blob/1b2d7253e854205d2c95c80b2c6a1cdd42e45059/frontend/discourse/app/lib/blocks/-internals/debug-hooks.ts#L82-L118","documentation":"Blocks debug registry: setCallback (or the lookup path sharing the key validation) received a callback key that is not one of the registered DEBUG_CALLBACK constants. This is a developer-tooling misuse error — dev-tools must use the exported DEBUG_CALLBACK_* constants rather than hand-written strings, since the valid key set is closed.","triggerScenarios":"Thrown at frontend/discourse/app/lib/blocks/-internals/debug-hooks.ts:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Import and use the DEBUG_CALLBACK constants from the blocks internals module instead of a literal string key.","If a new hook is genuinely needed, add a constant to the registry's valid keys first, then use it.","Check for typos/drift between the dev-tools version and the registry's key list."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1b2d7253e854205d2c95c80b2c6a1cdd42e45059","analyzedAt":"2026-08-26T03:11:08.302Z","contentChangedAt":"2026-08-26T03:11:08.302Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}