{"record":{"id":"1772b83135465805","repo":"homebridge/homebridge","slug":"matter-configuration-validation-failed-errors-m","errorCode":null,"errorMessage":"Matter configuration validation failed:\n${errors.map(e => `  - ${e}`).join('\n')}","messagePattern":"Matter configuration validation failed:\n(.+?)`\\)\\.join\\('\n'\\)\\}","errorType":"validation","errorClass":"MatterDeviceError","httpStatus":null,"severity":"error","filePath":"src/matter/server/ServerConfig.ts","lineNumber":96,"sourceCode":"  if (firmwareRevision !== undefined) {\n    firmwareRevision = truncateString(firmwareRevision, 64, 'Firmware revision').value\n  }\n\n  // Validate serialNumber\n  let serialNumber = config.serialNumber\n  if (serialNumber !== undefined) {\n    serialNumber = truncateString(serialNumber, 32, 'Serial number').value\n  }\n\n  // Validate debugModeEnabled\n  const debugModeEnabled = config.debugModeEnabled || false\n\n  // Validate externalAccessory\n  const externalAccessory = config.externalAccessory || false\n\n  // Throw if there are validation errors\n  if (errors.length > 0) {\n    throw new MatterDeviceError(\n      `Matter configuration validation failed:\\n${errors.map(e => `  - ${e}`).join('\\n')}`,\n    )\n  }\n\n  return {\n    port,\n    uniqueId,\n    storagePath,\n    displayName: config.displayName,\n    manufacturer,\n    model,\n    firmwareRevision,\n    serialNumber,\n    debugModeEnabled,\n    externalAccessory,\n    networkInterfaces: config.networkInterfaces,\n    disableIpv4: config.disableIpv4,\n    deferOnline: config.deferOnline,","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/homebridge/homebridge/blob/edf54930340d67cade23d01abd41b03cd9621e8b/src/matter/server/ServerConfig.ts#L78-L114","documentation":"ServerConfig.validateAndSanitizeConfig collects validation errors for the Matter server configuration (port, vendor/product ids, etc.) and throws a single aggregated MatterDeviceError listing every offending field when any are invalid. It runs when constructing the Matter server config.","triggerScenarios":"Config with an invalid or out-of-range port, missing/invalid vendorId or productId, invalid externalAccessory value, or other schema violations in the bridge.matter block.","commonSituations":"Hand-edited config.json with a string port or port 0, vendorId/productId outside 0x0001–0xFFF0, or a child bridge _block copied incorrectly.","solutions":["Read the bullet list in the error message — each line names one invalid field","Fix the matter block in config.json (valid port 1–65535, valid vendorId/productId)","Remove conflicting or unknown fields from the matter config","Restart homebridge after editing config"],"exampleFix":"// before\n\"matter\": { \"port\": \"5540\", \"vendorId\": 65535 }\n// after\n\"matter\": { \"port\": 5540, \"vendorId\": 65521, \"productId\": 32768 }","handlingStrategy":"validation","validationCode":"const port = Number(cfg.matter.port)\nif (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error('invalid matter port')\nif (cfg.matter.vendorId != null && (cfg.matter.vendorId < 1 || cfg.matter.vendorId > 65535)) throw new Error('invalid vendorId')","typeGuard":null,"tryCatchPattern":"try { await server.start() } catch (e) { if ((e as Error).message.startsWith('Matter configuration validation failed')) { console.error(e.message); process.exit(1) } throw e }","preventionTips":["Validate config.json against the documented Matter schema before restart","Use numeric (not string) port and ids in JSON","Read every bullet in the aggregated error — it lists all bad fields at once"],"tags":["matter","config","validation","schema"],"backgroundTag":"matter-config-validation-failed","analyzedSha":"edf54930340d67cade23d01abd41b03cd9621e8b","analyzedAt":"2026-08-30T21:28:53.235Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}