{"record":{"id":"c45ac9fa9fb916f7","repo":"immich-app/immich","slug":"unable-to-set-queue-concurrency-worker-not-found-queuename","errorCode":null,"errorMessage":"Unable to set queue concurrency, worker not found: '${queueName}'","messagePattern":"Unable to set queue concurrency, worker not found: '(.+?)'","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/src/repositories/job.repository.ts","lineNumber":150,"sourceCode":"      }\n    }\n    this.microservicesPresent = isPresent;\n  }\n\n  async run({ name, data }: JobItem) {\n    const item = this.handlers[name as JobName];\n    if (!item) {\n      this.logger.warn(`Skipping unknown job: \"${name}\"`);\n      return JobStatus.Skipped;\n    }\n\n    return item.handler(data);\n  }\n\n  setConcurrency(queueName: QueueName, concurrency: number) {\n    const worker = this.workers[queueName];\n    if (!worker) {\n      this.logger.warn(`Unable to set queue concurrency, worker not found: '${queueName}'`);\n      return;\n    }\n\n    worker.concurrency = concurrency;\n  }\n\n  async isActive(name: QueueName): Promise<boolean> {\n    const queue = this.getQueue(name);\n    const count = await queue.getActiveCount();\n    return count > 0;\n  }\n\n  async isPaused(name: QueueName): Promise<boolean> {\n    return this.getQueue(name).isPaused();\n  }\n\n  pause(name: QueueName) {\n    return this.getQueue(name).pause();","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/immich-app/immich/blob/e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c/server/src/repositories/job.repository.ts#L132-L168","documentation":"setConcurrency looks up the BullMQ Worker instance for the given queue and sets its concurrency. If no worker object exists for that queue name, it logs this warning and returns without changing anything. Concurrency for that queue remains at its default.","triggerScenarios":"setConcurrency(queueName, concurrency) is called for a QueueName whose worker hasn't been created yet in this.workers — e.g. called before worker initialization or for a queue that this process does not consume.","commonSituations":"Calling setConcurrency during startup before startWorkers registers workers; calling it on the API server process where workers run in microservices; a queue name typo or a queue removed in a newer version.","solutions":["Call setConcurrency only after workers are initialized (after startWorkers resolves)","Run it in the process that actually consumes the queue (the microservices worker, not the API server)","Verify the QueueName value matches an existing registered queue exactly","Log/persist desired concurrency config and apply it in worker bootstrap if ordering is the issue"],"exampleFix":"// before\nawait app.listen(port);\njobRepository.setConcurrency(QueueName.MachineLearning, 2);\n// after\nawait app.listen(port);\nawait jobRepository.startWorkers();\njobRepository.setConcurrency(QueueName.MachineLearning, 2);","handlingStrategy":"validation","validationCode":"function canSetConcurrency(job: JobRepository, q: QueueName): boolean {\n  return q in (job as any).workers;\n}\nif (!canSetConcurrency(job, QueueName.MachineLearning)) {\n  await job.startWorkers(); // initialize workers first\n}\njob.setConcurrency(QueueName.MachineLearning, 2);","typeGuard":"function workerExists(job: JobRepository, q: QueueName): boolean {\n  const workers = (job as unknown as { workers: Record<string, unknown> }).workers;\n  return Boolean(workers?.[q]);\n}","tryCatchPattern":null,"preventionTips":["Call setConcurrency only after startWorkers() completes","Only tune concurrency in the process consuming the queue (microservices)","Keep queue names in one enum to avoid typos","Apply concurrency settings during worker bootstrap, not at request time"],"tags":["bullmq","queue","worker","initialization-order"],"backgroundTag":"resource-not-found","analyzedSha":"e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c","analyzedAt":"2026-09-15T07:20:19.675Z","contentChangedAt":"2026-09-15T07:20:19.675Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}