immich-app/immich · critical · Error
Unable to determine worker type
Error message
Unable to determine worker type
What it means
EventRepository.setup calls configRepository.getWorker() to know which worker it is running as. If that returns a falsy value (worker type could not be resolved from config), it throws Error('Unable to determine worker type') before event-handler discovery proceeds. The worker identity is required to decide which handlers to register.
Source
Thrown at server/src/repositories/event.repository.ts:167
@Injectable()
export class EventRepository {
private emitHandlers: EmitHandlers = {};
constructor(
private moduleRef: ModuleRef,
private configRepository: ConfigRepository,
private logger: LoggingRepository,
) {
this.logger.setContext(EventRepository.name);
}
setup({ services }: { services: (new (...args: any[]) => unknown)[] }) {
const reflector = this.moduleRef.get(Reflector, { strict: false });
const items: Item<EmitEvent>[] = [];
const worker = this.configRepository.getWorker();
if (!worker) {
throw new Error('Unable to determine worker type');
}
// discovery
for (const Service of services) {
const instance = this.moduleRef.get<any>(Service);
const ctx = Object.getPrototypeOf(instance);
for (const property of Object.getOwnPropertyNames(ctx)) {
const descriptor = Object.getOwnPropertyDescriptor(ctx, property);
if (!descriptor || descriptor.get || descriptor.set) {
continue;
}
const handler = instance[property];
if (typeof handler !== 'function') {
continue;
}
const event = reflector.get<EventConfig>(MetadataKey.EventConfig, handler);View on GitHub (pinned to 199723261c)
Solutions
- Ensure at least one valid ImmichWorker remains after include/exclude (default is api + microservices).
- Unset IMMICH_WORKERS_INCLUDE/EXCLUDE to fall back to defaults.
- Check getWorker()/getEnv().workers to see what the process resolved to.
Defensive patterns
Strategy: validation
Validate before calling
const inc = (process.env.IMMICH_WORKERS_INCLUDE ?? '').split(',').filter(Boolean);
const exc = new Set((process.env.IMMICH_WORKERS_EXCLUDE ?? '').split(',').filter(Boolean));
const effective = inc.filter((w) => !exc.has(w));
if (effective.length === 0) throw new Error('Worker set is empty after include/exclude.'); Prevention
- Do not exclude all workers; keep at least api or microservices.
- Leave worker env unset to use safe defaults.
- Validate the effective worker set in CI for split-role deploys.
When it happens
Trigger: Starting Immich when the effective worker set is empty (e.g. IMMICH_WORKERS_INCLUDE and IMMICH_WORKERS_EXCLUDE cancel out to nothing) or the config bootstrap failed to assign a worker to the process.
Common situations: Misconfigured IMMICH_WORKERS_* env vars producing an empty set; running a process role that resolves to no recognized worker; config drift after an upgrade.
Related errors
- Invalid worker(s) found: ${workers.join(',')}
- Failed to read helmet file: ${helmetFile}
- Invalid environment variables: \n - [${path}] ${issue.messa
- Failed to decode redis options
- Invalid telemetry found: ${telemetry}
AI-assisted analysis of immich-app/immich@199723261c (2026-08-12).
Data as JSON: /api/errors/c27268bb7774a405.
Report an issue: GitHub.