{"record":{"id":"cf2e2a8eed42e663","repo":"toeverything/AFFiNE","slug":"invalid-rowid","errorCode":null,"errorMessage":"Invalid rowId","messagePattern":"Invalid rowId","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"blocksuite/affine/blocks/database/src/utils/block-utils.ts","lineNumber":190,"sourceCode":"        value: cell.value,\n      };\n    }\n  });\n}\n\nexport function updateCells(\n  model: DatabaseBlockModel,\n  columnId: string,\n  cells: Record<string, unknown>\n) {\n  model.store.transact(() => {\n    Object.entries(cells).forEach(([rowId, value]) => {\n      if (\n        rowId === '__proto__' ||\n        rowId === 'constructor' ||\n        rowId === 'prototype'\n      ) {\n        throw new Error('Invalid rowId');\n      }\n      if (!model.props.cells[rowId]) {\n        model.props.cells[rowId] = Object.create(null);\n      }\n      if (model.props.cells[rowId]) {\n        model.props.cells[rowId][columnId] = {\n          columnId,\n          value,\n        };\n      }\n    });\n  });\n}\n\nexport function updateProperty(\n  model: DatabaseBlockModel,\n  id: string,\n  updater: ColumnUpdater,","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/blocksuite/affine/blocks/database/src/utils/block-utils.ts#L172-L208","documentation":"When a component is registered with a dependency array (framework.service/impl/override with [deps]), dependenciesToFactory interprets each entry as exactly one constructor argument: a bare identifier resolves via provider.get, and a nested array resolves via provider.getAll (all variants) but must contain exactly one identifier. A nested array of any other length matches neither form, so the factory throws 'Invalid dependency' the first time the component is constructed.","triggerScenarios":"Declaring deps as [Storage, [Cache, Logger]] intending two same-kind dependencies; passing an empty nested array [[]] where [[Identifier]] was meant; dynamically building deps arrays and accidentally nesting several identifiers into one sub-array.","commonSituations":"Constructor signatures refactored so several deps arrive together; code that spreads a list into one nested array ([...ids] instead of ids.map(id => [id])); teams assuming the nested array means 'array of these deps, plural' when it strictly means getAll of ONE identifier.","solutions":["Use exactly one identifier per nested array entry: [Storage, [Logger]] resolves Storage via get and Logger[] via getAll","Give each dependency its own top-level entry instead of grouping several inside one nested array","If deps are computed at runtime, assert each entry is an Identifier or a length-1 array before calling service()/impl()"],"exampleFix":"// before\nfw.service(A, [Storage, [Cache, Logger]]); // nested array length 2 -> 'Invalid dependency'\n\n// after\nfw.service(A, [Storage, [Cache]]); // getAll(Cache)\n// A's constructor receives (storage: Storage, caches: Cache[], provider)","handlingStrategy":"type-guard","validationCode":"function assertValidDeps(deps: unknown[]) {\n  for (const dep of deps) {\n    if (Array.isArray(dep) && dep.length !== 1) {\n      throw new Error(`Invalid dependency: nested arrays must hold exactly one identifier, got ${dep.length}`);\n    }\n  }\n}\nassertValidDeps([Storage, [Cache]]); // ok\n// assertValidDeps([Storage, [Cache, Logger]]); // fails fast with your own message","typeGuard":"const isValidDep = (dep: unknown) =>\n  !Array.isArray(dep) || dep.length === 1;","tryCatchPattern":null,"preventionTips":["Remember the convention: bare identifier = get, [identifier] (exactly one) = getAll","Never group multiple identifiers inside one nested array","Validate dynamically built deps arrays before passing them to service()/impl()"],"tags":["dependency-injection","registration","dependencies","invalid-argument"],"backgroundTag":"invalid-di-dependency-declaration","analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}