siyuan-note/siyuan · error
Failed to update the global plugin state
Error message
Failed to update the global plugin state
What it means
setGlobalPluginsDisabled posts petalDisabled to /api/setting/setBazaarPetalDisabled and requires code===0 plus data (the reload payload). Any missing data, non-zero code, or failed request throws with the kernel msg or this fallback, before applyPluginReload runs.
Solutions
- Retry the toggle after confirming the kernel is responding
- Check kernel logs for setBazaarPetalDisabled errors
- Verify response.data is present — a missing payload indicates a kernel-side issue to report/fix
- Ensure the workspace is not locked/unavailable during the change
Example fix
// before
await setGlobalPluginsDisabled(app, true);
// after
try { await setGlobalPluginsDisabled(app, true); } catch (e) { showMessage(e.message); } Defensive patterns
Strategy: try-catch
Validate before calling
const resp = await fetchSyncPost("/api/setting/setBazaarPetalDisabled", {petalDisabled}).catch(() => null); if (!resp || resp.code !== 0 || !resp.data) return false; return true; Type guard
const hasReloadData = (r: any): r is {code: 0; data: TGlobalPluginReloadData} => r?.code === 0 && !!r?.data; Try / catch
try { await setGlobalPluginsDisabled(app, disabled); } catch (e) { revertSwitch(); showMessage(e.message); } Prevention
- Verify kernel availability before toggling global settings
- Revert the settings switch on failure
- Check response.data presence to distinguish kernel bugs from request failures
When it happens
Trigger: Toggling the global 'disable all plugins' setting when the kernel call fails: response.code !== 0, response.data missing, or the request itself failed (undefined response).
Common situations: Kernel busy or restarted while switching the setting; a kernel bug returning no reload data; workspace locked by sync; API failure due to auth/token expiry in browser mode.
Related errors
- Access to encrypted notebook data is not supported via this…
- AI editor action must not be empty
- AI editor action not found
- [/api/av/batchSetAttributeViewBlockAttrs] parameter [rowID]…
- asset path [ ] does not match data path [ ]
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/b122c38511f77b7f.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/plugin/globalState.ts:53
export const applyPluginReload = (app: App, data: IPluginReloadData = {}) => {
if (!isGlobalPluginState(data)) {
return reloadPlugin(app, data);
}
return getCoordinator(app).apply(data);
};
export const syncGlobalPluginConfig = (app: App, petalDisabled: boolean) => {
getCoordinator(app).syncConfig(petalDisabled);
};
export const subscribeGlobalPluginState = (app: App, listener: (state: IGlobalPluginStateSnapshot) => void) =>
getCoordinator(app).subscribe(listener);
export const setGlobalPluginsDisabled = async (app: App, petalDisabled: boolean) => {
const response = await fetchSyncPost("/api/setting/setBazaarPetalDisabled", {petalDisabled});
if (response.code !== 0 || !response.data) {
throw new Error(response.msg || "Failed to update the global plugin state");
}
await applyPluginReload(app, response.data as TGlobalPluginReloadData);
};
View on GitHub (pinned to 9f775e8a12)