Skip to content

Binary blob responses cause JSON.parse failure in --agent mode #86

@ameet

Description

@ameet

Description

When using --agent mode to execute actions that return binary content (e.g., Google Drive file downloads with alt=media), the CLI's action executor reads the HTTP response as text and attempts JSON.parse(). Binary content (PDFs, images, PPTX files) causes immediate parse failure.

Reproduction

one --agent actions execute google-drive <download-action-id> <connection-key> \
  --path-vars '{"fileId":"<any-file-id>"}' \
  --query-params '{"alt":"media","supportsAllDrives":true}'

Expected: Binary content returned or base64-encoded
Actual: Unexpected token % or Unexpected token < (if HTML error page)

Impact

Any flow that needs to download binary files from connected platforms (Google Drive, Dropbox, etc.) cannot use the standard --agent action executor. Workaround requires bypassing the CLI and making direct HTTP requests using the platform's API, while still needing the CLI's connection credentials.

Suggested Fix

Detect non-JSON content types (application/pdf, application/octet-stream, image/*, etc.) before attempting JSON.parse(). Options:

  1. Return {"type":"binary","path":"/tmp/one-download-<hash>.<ext>"} after writing to disk
  2. Return {"type":"binary","base64":"..."} for small files
  3. Add a --output-file <path> flag for binary downloads

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions