thedotmack/claude-mem · error

unknown server generation job kind

Error message

unknown server generation job kind: ${kind}

What it means

getQueue looks up a ServerJobQueue by ServerGenerationJobKind and throws when the kind has no registered queue in the manager's queues map. The map is built from the known job kinds, so an unrecognized or unconfigured kind cannot be started or accessed.

Solutions

  1. Register the missing kind in ActiveServerQueueManager.buildQueues so a queue exists for it
  2. Validate the kind against the known kinds before calling getQueue/start
  3. Migrate or filter stale job records whose kinds no longer exist

Example fix

// before
manager.start('newKind' as ServerGenerationJobKind, processor); // not registered -> throws
// after
if (!SUPPORTED_KINDS.has(kind)) return; // or register 'newKind' in buildQueues
manager.start(kind, processor);
Defensive patterns

Strategy: type-guard

Validate before calling

const KNOWN_KINDS = new Set<string>(Object.values(ServerGenerationJobKind));
if (!KNOWN_KINDS.has(kind)) throw new Error(`unregistered job kind: ${kind}`);
manager.getQueue(kind);

Type guard

function isRegisteredKind(kind: string, queues: Map<ServerGenerationJobKind, unknown>): kind is ServerGenerationJobKind {
  return queues.has(kind as ServerGenerationJobKind);
}

Try / catch

try {
  manager.getQueue(kind).start(processor);
} catch (e) {
  if (String(e.message).startsWith('unknown server generation job kind')) {
    logger.error(`job kind ${kind} is not registered in buildQueues`);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling manager.getQueue(kind) or manager.start(kind, processor) with a ServerGenerationJobKind value that was never added to buildQueues — e.g. a newly added enum kind not wired into buildQueues, or a stale/typo kind string.

Common situations: Adding a new generation job kind to the type but forgetting to register it in buildQueues; passing a kind read from stale persisted data produced by a different version; deserializing job kinds from a DB or queue payload without validating them.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/bae51334061958b2. Report an issue: GitHub.

Appendix: source

Thrown at src/server/runtime/ActiveServerQueueManager.ts:51

  private closed = false;

  constructor(
    private readonly config: RedisQueueConfig,
    queues?: Map<ServerGenerationJobKind, ServerJobQueue<ServerGenerationJobPayload>>,
  ) {
    if (config.engine !== 'bullmq') {
      throw new Error(
        `ActiveServerQueueManager requires CLAUDE_MEM_QUEUE_ENGINE=bullmq (got ${config.engine}); ` +
          'do not instantiate when bullmq is not selected.',
      );
    }
    this.queues = queues ?? this.buildQueues(config);
  }

  getQueue(kind: ServerGenerationJobKind): ServerJobQueue<ServerGenerationJobPayload> {
    const queue = this.queues.get(kind);
    if (!queue) {
      throw new Error(`unknown server generation job kind: ${kind}`);
    }
    return queue;
  }

  start(kind: ServerGenerationJobKind, processor: Processor<ServerGenerationJobPayload>): void {
    this.getQueue(kind).start(processor);
  }

  getHealth(): ServerBoundaryHealth {
    if (this.closed) {
      return { status: 'errored', reason: 'queue-manager closed' };
    }
    const lanes = QUEUE_KINDS.map((kind) => ({ kind, name: SERVER_JOB_QUEUE_NAMES[kind] }));
    return {
      status: 'active',
      reason: 'BullMQ-backed queue manager wired',
      details: {
        engine: this.config.engine,

View on GitHub (pinned to d8bc9755e7)