Skip to content

pipeline logs: 406 Not Acceptable — client sends Accept: application/json but log endpoint returns text/plain #51

Description

@fireboy1919

Bug

bb pipeline logs <pipeline> always returns:

✗ failed to get step logs: API error 406: Not Acceptable

Root cause

internal/api/client.go sets Accept: application/json on every request:

httpReq.Header.Set("Accept", "application/json")

The Bitbucket pipeline step log endpoint (/repositories/{workspace}/{repo}/pipelines/{uuid}/steps/{uuid}/log) returns text/plain, not JSON. Sending Accept: application/json to a text-only endpoint produces a 406 Not Acceptable response.

Fix

The log endpoint should be called with Accept: text/plain (or no Accept header). The client either needs per-request Accept header overrides, or the logs command needs to bypass the default client and set the header directly.

Steps to reproduce

bb pipeline logs <pipeline-number>
# ✗ failed to get step logs: API error 406: Not Acceptable

Environment

  • bb CLI (latest)
  • Any Bitbucket repository with pipelines enabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions