{"record":{"id":"a7ec11917cb7e295","repo":"toeverything/AFFiNE","slug":"gfxblockelementerror","errorCode":"GfxBlockElementError","errorMessage":"Frame model is not found","messagePattern":"Frame model is not found","errorType":"exception","errorClass":"BlockSuiteError","httpStatus":null,"severity":"error","filePath":"blocksuite/affine/blocks/frame/src/frame-manager.ts","lineNumber":224,"sourceCode":"    frame.addChildren(childElements);\n  }\n\n  private _addFrameBlock(bound: Bound) {\n    const surfaceModel = this.gfx.surface as SurfaceBlockModel;\n    const props = this.gfx.std\n      .get(EditPropsStore)\n      .applyLastProps('affine:frame', {\n        title: new Text(new Y.Text(`Frame ${this.frames.length + 1}`)),\n        xywh: bound.serialize(),\n        index: this.gfx.layer.generateIndex(true),\n        presentationIndex: this.generatePresentationIndex(),\n      });\n\n    const id = this.gfx.doc.addBlock('affine:frame', props, surfaceModel);\n    const frameModel = this.gfx.getElementById(id);\n\n    if (!frameModel || !isFrameBlock(frameModel)) {\n      throw new BlockSuiteError(\n        ErrorCode.GfxBlockElementError,\n        'Frame model is not found'\n      );\n    }\n\n    return frameModel;\n  }\n\n  private _watchElementAdded() {\n    if (!this.gfx.surface) {\n      return;\n    }\n\n    const { surface: surfaceModel, doc } = this.gfx;\n\n    this._disposable.add(\n      surfaceModel.elementAdded.subscribe(({ id, local }) => {\n        const element = surfaceModel.getElementById(id);","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/blocksuite/affine/blocks/frame/src/frame-manager.ts#L206-L242","documentation":"Identical wrapping to the single-get path, but raised while provider.getAll(identifier) instantiates each registered variant: one variant's factory failed to resolve its own dependency, and the Resolver attributes the failure to the whole getAll identifier with the failing inner target named in the message. getAll builds every variant eagerly, so one broken variant poisons the entire map.","triggerScenarios":"provider.getAll(Storage) where one variant (e.g. 'session') depends on an identifier that is not registered; a deps entry declared as [[Dep]] (getAll form) while some variant of the resolved identifier assumes infra the host never registered.","commonSituations":"Extension points where third-party/plugin variants assume host infrastructure that was not set up; partial test fixtures registering only some variants' dependencies; a variant left registered after its dependency module was removed.","solutions":["Register the missing dependency named as target so every variant can construct","Remove the broken variant if unneeded: framework.override(Identifier('brokenVariant'), null) removes it from the registry","If partial results are acceptable, wrap getAll in try-catch on MissingDependencyError, or resolve variants individually with getOptional and skip failures"],"exampleFix":"// before\nfw.impl(Storage('local'), LocalStorage);\nfw.impl(Storage('session'), SessionStorage); // SessionStorage dep missing\nprovider.getAll(Storage); // Missing dependency ... in creating [Storage]\n\n// after\nfw.service(SessionStorage, [SessionStore]); // register the variant's dependency\nprovider.getAll(Storage); // Map { local, session }","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"import { MissingDependencyError } from '.../framework/core/error';\n\ntry {\n  const all = provider.getAll(Storage);\n} catch (err) {\n  if (err instanceof MissingDependencyError) {\n    // err.target names the missing dep of one variant; register it or remove that variant\n  } else {\n    throw err;\n  }\n}","preventionTips":["Every variant registered under an identifier must have its full dependency set available","Resolve individual variants with getOptional when partial availability is acceptable","Remove obsolete variants with override(Identifier('variant'), null) when their deps go away"],"tags":["dependency-injection","resolution","missing-dependency","getall"],"backgroundTag":"missing-di-dependency","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"}