ComposioHQ/composio · error · KeyringError
CFDictionaryCreateMutable returned NULL
Error message
CFDictionaryCreateMutable returned NULL
What it means
CFDictionaryCreateMutable returned NULL when allocating the mutable dictionary used to build a Security framework query. KeyringError kind 'PlatformFailure'.
Source
Thrown at ts/packages/cli-keyring/src/stores/macos-security-ffi.ts:394
}
// CFData storage is a real heap pointer (never tagged), so the
// BigInt value fits in JS safe integer range and we can hand it to
// toArrayBuffer via Number. Copy into JS-owned memory so we don't
// retain the CFData longer than necessary.
const view = new Uint8Array(toArrayBuffer(Number(bytePtr) as unknown as never, 0, length));
return new Uint8Array(view);
}
/** Build a mutable CFDictionary. */
function cfMutableDict(pool: CFPool): bigint {
const dict = cf.symbols.CFDictionaryCreateMutable(
0n,
0n,
K.kCFTypeDictionaryKeyCallBacks,
K.kCFTypeDictionaryValueCallBacks
);
if (dict === 0n) {
throw new KeyringError({
kind: 'PlatformFailure',
cause: new Error('CFDictionaryCreateMutable returned NULL'),
});
}
return pool.retain(dict);
}
function cfDictSet(dict: bigint, key: bigint, value: bigint): void {
cf.symbols.CFDictionaryAddValue(dict, key, value);
}
// -----------------------------------------------------------------------------
// Store implementation
// -----------------------------------------------------------------------------
function validateSpecifier(service: string, user: string): void {
if (service.length === 0) {
throw new KeyringError({View on GitHub (pinned to 64b1b85502)
Solutions
- Free leaked CF objects (ensure autorelease pools/release paths run) and retry
- Raise memory limits or restart the process
- Audit usage to ensure each operation's CF pool is drained
Defensive patterns
Strategy: retry
Try / catch
catch (e) { if (e instanceof KeyringError && e.kind === 'PlatformFailure' && /CFDictionaryCreateMutable/.test(String(e.cause))) { return withRetry(fn, 1); } throw e; } Prevention
- Drain/release CF pools after each FFI operation
- Set memory limits that accommodate the FFI layer
When it happens
Trigger: Any keyring query operation on macOS when CoreFoundation cannot allocate a new mutable dictionary — typically memory exhaustion.
Common situations: Long-running processes with leaks, containers with strict memory limits, or cascading failures after earlier FFI errors.
Related errors
- PlatformFailure
- dlsym(${name}) failed
- CFStringCreateWithBytes returned NULL
- CFDataGetBytePtr returned NULL
- Invalid
AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28).
Data as JSON: /api/errors/99c863747da76a32.
Report an issue: GitHub.