{"record":{"id":"9d5d9addfdbabd6c","repo":"toeverything/AFFiNE","slug":"valuenotexists-9d5d9a","errorCode":"ValueNotExists","errorMessage":"Extension scope ${scope} not found","messagePattern":"Extension scope (.+?) not found","errorType":"exception","errorClass":"BlockSuiteError","httpStatus":null,"severity":"error","filePath":"blocksuite/affine/ext-loader/src/manager.ts","lineNumber":103,"sourceCode":"    return context;\n  };\n\n  /**\n   * Retrieves all extensions registered for a specific scope.\n   * It triggers the build process.\n   *\n   * @param scope - The scope to retrieve extensions for\n   * @returns An array of extensions registered for the specified scope\n   * @throws {BlockSuiteError} If the scope is not found\n   */\n  get(scope: Scope) {\n    if (this._extensions.has(scope)) {\n      this._extensions.delete(scope);\n    }\n    this._build(scope);\n    const extensionSet = this._extensions.get(scope);\n    if (!extensionSet) {\n      throw new BlockSuiteError(\n        BlockSuiteError.ErrorCode.ValueNotExists,\n        `Extension scope ${scope} not found`\n      );\n    }\n    return Array.from(extensionSet);\n  }\n\n  /**\n   * Configures a specific provider with new options.\n   * Can update existing configuration or remove it entirely.\n   * Triggers a rebuild of the provider instance when configuration changes.\n   *\n   * @typeParam T - The type of configuration options for the provider\n   * @param provider - The provider class to configure\n   * @param options - New configuration options or a function to update existing options\n   */\n  configure<T extends Empty>(\n    provider: typeof BaseExtensionProvider<Scope, T>,","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/26c515e050211269e911f7d9cfe162a26c83ed98/blocksuite/affine/ext-loader/src/manager.ts#L85-L121","documentation":"ExtensionManager.get(scope) triggers _build(scope), which runs every provider's setup() giving each a chance to register extensions for that scope. If after build no extensions were registered for the scope (the map has no entry) it throws ValueNotExists. Note the method also deletes a pre-existing scope entry before rebuilding, so a provider that does not re-register leaves the scope empty.","triggerScenarios":"Calling get(scope) for a scope that no provider's setup() registers into; or configuring a provider so it no longer registers (e.g. removing its options) then calling get() on a scope it used to populate.","commonSituations":"Mistyped/unknown scope string; provider misconfiguration that skips registration; ordering issue where get() is called before providers are configured.","solutions":["Confirm the scope string matches what providers register under.","Ensure at least one provider's setup() calls context.register() for the requested scope.","Check configure() calls did not disable the only provider for that scope."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"manager.get(scope); // ensure at least one provider's setup() calls context.register() for this scope before calling get()","typeGuard":"const scopeRegistered = (m: ExtensionManager<string>, scope: string): boolean => { try { return m.get(scope as never).length > 0; } catch { return false; } };","tryCatchPattern":"try { const exts = manager.get(scope); } catch (e) { if (e instanceof BlockSuiteError && e.code === BlockSuiteError.ErrorCode.ValueNotExists) { /* scope misconfigured — check providers */ } }","preventionTips":["Verify the scope string matches provider registration","Confirm providers are configured before get() is called"],"tags":["extension","scope","ext-loader","initialization"],"backgroundTag":null,"analyzedSha":"26c515e050211269e911f7d9cfe162a26c83ed98","analyzedAt":"2026-08-12T13:15:16.447Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}