discourse/discourse · error · Error

[Blocks] Unknown debug callback key: "${key}". Valid keys ar

Error message

[Blocks] Unknown debug callback key: "${key}". Valid keys are: ${validKeys}.

What it means

Error "[Blocks] Unknown debug callback key: "${key}". Valid keys are: ${validKeys}." thrown in discourse/discourse.

Source

Thrown at frontend/discourse/app/lib/blocks/-internals/debug-hooks.ts:100

   * @param key - The callback key (use DEBUG_CALLBACK constants).
   * @returns The callback function, or null/undefined if not set.
   */
  getCallback(key: string): DebugCallback | null | undefined {
    return this.#callbacks.get(key);
  }

  /**
   * Sets a debug callback in the registry.
   * Used by dev-tools to register debug hooks.
   *
   * @param key - The callback key (use DEBUG_CALLBACK constants).
   * @param value - The callback function, or null to clear.
   * @throws If the key is not a valid callback key.
   */
  setCallback(key: string, value: DebugCallback | null): void {
    if (!this.#callbacks.has(key)) {
      const validKeys = Object.values(DEBUG_CALLBACK).join(", ");
      throw new Error(
        `[Blocks] Unknown debug callback key: "${key}". Valid keys are: ${validKeys}.`
      );
    }
    this.#callbacks.set(key, value);
  }

  /**
   * Returns whether console logging is enabled.
   * Convenience getter that invokes the blockLogging callback.
   *
   * @returns True if logging is enabled.
   */
  get isBlockLoggingEnabled(): boolean {
    return (
      (this.#callbacks.get(DEBUG_CALLBACK.BLOCK_LOGGING)?.() as
        | boolean
        | undefined) ?? false
    );

View on GitHub (pinned to 1b2d7253e8)

When it happens

Trigger: Thrown at frontend/discourse/app/lib/blocks/-internals/debug-hooks.ts:100 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of discourse/discourse@1b2d7253e8 (2026-08-26). Data as JSON: /api/errors/50b9063f5bb284a2. Report an issue: GitHub.