Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 03:15 UTC
fix(cli): prevent unhandled promise rejection from sync throw in writeState
Wrap the synchronous mkdirSync call inside writeState in a try-catch so it always returns a Promise, preventing unhandled rejections when the directory creation fails (e.g., permissions error, read-only fs).
jkomyno committed
Mar 12, 2026 at 01:10 UTC
1e521250f5db125069a3aa67eaee516dbfaece6c
1 file changed
+7
-2
ts/packages/cli/src/services/update-check.ts
+7
-2
@@ -137,8 +137,13 @@ export function createUpdateChecker(config: UpdateCheckConfig) {
137
// Always persist lastChecked to prevent retry loops when the fetch
138
// fails or returns no matching tags.
139
const writeState = (latestVersion?: string): Promise<void> => {
140
- const stateDir = dirname(config.stateFile);
141
- mkdirSync(stateDir, { recursive: true });
140
+ try {
141
+ const stateDir = dirname(config.stateFile);
142
+ mkdirSync(stateDir, { recursive: true });
143
+ } catch {
144
+ // If we can't create the directory, bail out silently.
145
+ return Promise.resolve();
146
+ }
147
148
const state: UpdateCheckState = {
149
lastChecked: new Date().toISOString(),