{"record":{"id":"4167afdcababfac0","repo":"immich-app/immich","slug":"device-devicename-does-not-exist-if-using-do","errorCode":null,"errorMessage":"Device '${deviceName}' does not exist. If using Docker, make sure this device is mounted","messagePattern":"Device '(.+?)' does not exist\\. If using Docker, make sure this device is mounted","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/utils/media.ts","lineNumber":462,"sourceCode":"      throw new Error('No /dev/dri devices found. If using Docker, make sure at least one /dev/dri device is mounted');\n    }\n\n    return devices.filter(function (device) {\n      return device.startsWith('renderD') || device.startsWith('card');\n    });\n  }\n\n  getDevice({ dri }: VideoInterfaces) {\n    if (this.config.preferredHwDevice === 'auto') {\n      // eslint-disable-next-line unicorn/no-array-reduce\n      return `/dev/dri/${this.validateDevices(dri).reduce(function (a, b) {\n        return a.localeCompare(b) < 0 ? b : a;\n      })}`;\n    }\n\n    const deviceName = this.config.preferredHwDevice.replace('/dev/dri/', '');\n    if (!dri.includes(deviceName)) {\n      throw new Error(`Device '${deviceName}' does not exist. If using Docker, make sure this device is mounted`);\n    }\n\n    return `/dev/dri/${deviceName}`;\n  }\n\n  getVideoCodec(): string {\n    return `${this.config.targetVideoCodec}_${this.config.accel}`;\n  }\n\n  getGopSize() {\n    if (this.config.gopSize <= 0) {\n      return 256;\n    }\n    return this.config.gopSize;\n  }\n}\n\nexport class ThumbnailConfig extends BaseConfig {","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/immich-app/immich/blob/e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c/server/src/utils/media.ts#L444-L480","documentation":"getDevice() resolves the preferred hardware device from config (preferredHwDevice). After stripping the '/dev/dri/' prefix, it checks the configured name actually exists among the discovered DRM devices; if not, it throws so transcoding fails fast instead of passing a nonexistent device to ffmpeg.","triggerScenarios":"Setting 'Preferred hardware device' in transcoding settings (config.preferredHwDevice) to a specific /dev/dri node (e.g. renderD129) that is not present in the container's /dev/dri directory.","commonSituations":"Copy-pasting a device name from another machine (renderD128 vs renderD129 numbering differs per host); moving the stack to new hardware; mounting only card0 while config references renderD128, or vice versa.","solutions":["Set the preferred hardware device to an existing node: run 'ls /dev/dri' and configure exactly one of those names (e.g. /dev/dri/renderD128).","Clear the preferred device selection (leave it as automatic) so the library picks an available device itself.","If the device genuinely exists on the host, ensure it is mounted into the container via devices: [/dev/dri:/dev/dri].","After driver/kernel updates changed renderD numbering, update the config to the new node name."],"exampleFix":"// before (config)\npreferredHwDevice: '/dev/dri/renderD129'\n// after (verify with: ls /dev/dri)\npreferredHwDevice: '/dev/dri/renderD128'","handlingStrategy":"validation","validationCode":"const name = config.preferredHwDevice.replace('/dev/dri/', '');\nif (config.preferredHwDevice && !fs.readdirSync('/dev/dri').includes(name)) {\n  console.warn(`preferredHwDevice ${name} not found; using auto-detect`);\n  delete config.preferredHwDevice;\n}","typeGuard":null,"tryCatchPattern":"try { startServer({ preferredHwDevice }); } catch (e) { if (e.message.includes('does not exist')) { startServer({ preferredHwDevice: null }); } else throw e; }","preventionTips":["Leave preferred device unset (auto) unless you specifically need a node","Re-check /dev/dri naming after kernel/driver upgrades or host migration","Use infrastructure-as-code so compose device mounts and config stay in sync"],"tags":["hardware-acceleration","docker","configuration","gpu"],"backgroundTag":"invalid-config-value","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"}