Skip to content

fix(audiomind): handle file I/O errors in persistBase64Audio - #3

Open
motorbunty wants to merge 1 commit into
pexoai:mainfrom
motorbunty:fix/audiomind-cli-file-io-error-handling
Open

fix(audiomind): handle file I/O errors in persistBase64Audio#3
motorbunty wants to merge 1 commit into
pexoai:mainfrom
motorbunty:fix/audiomind-cli-file-io-error-handling

Conversation

@motorbunty

Copy link
Copy Markdown

Problem

In skills/videoagent-audio-studio/cli.js, the persistBase64Audio() function calls fs.mkdirSync() and fs.writeFileSync() (lines 90-93) without any error handling. If the output directory can't be created (permissions issue) or the file can't be written (disk full, read-only filesystem), the entire CLI crashes with an unhandled exception — even though the audio data is still available in memory as base64.

Solution

Wrap the two file system calls in a try-catch. On failure, log a warning to stderr and return the original result object (with base64 still intact), so downstream consumers can still use the audio data. On success, behavior is unchanged.

Testing

Verified that the happy path still works as before. The error path was tested by pointing AUDIOMIND_OUTPUT_DIR to a read-only directory — the CLI now logs a warning and returns the base64 result instead of crashing.

Wrap mkdirSync/writeFileSync in try-catch so the CLI returns
the original base64 result instead of crashing when the output
directory is not writable or the disk is full.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant