we-promise/sure · error · Provider::Redbark::AuthenticationError

access_forbidden

access_forbidden

Error message

Access forbidden - your Redbark plan may not include API access

What it means

Raised by Provider::Redbark's handle_response on HTTP 403 as AuthenticationError with error_type :access_forbidden. Distinct from 401: the key is recognized as valid, but the Redbark plan tied to it is not entitled to API access. Every endpoint will fail with this until the plan changes.

Source

Thrown at app/models/provider/redbark.rb:242

        "Authorization" => "Bearer #{@api_key}",
        "Content-Type" => "application/json",
        "Accept" => "application/json"
      }
    end

    # Redbark error envelope: { error: { message, code, details } }
    # Error messages carry the parsed provider message only, never the raw
    # response body - callers log and re-log these strings.
    def handle_response(response)
      case response.code
      when 200, 201
        JSON.parse(response.body, symbolize_names: true)
      when 400
        raise Error.new("Bad request: #{error_message_from(response)}", :bad_request)
      when 401
        raise AuthenticationError.new("Invalid API key", :unauthorized)
      when 403
        raise AuthenticationError.new("Access forbidden - your Redbark plan may not include API access", :access_forbidden)
      when 404
        raise Error.new("Resource not found", :not_found)
      when 410
        raise Error.new("Endpoint requires an accountId: #{error_message_from(response)}", :bad_request)
      when 429
        raise RateLimitError.new("Rate limit exceeded", :rate_limited)
      when 500..599
        raise ServerError.new("Redbark server error (#{response.code})", :server_error)
      else
        raise Error.new("Unexpected response #{response.code}: #{error_message_from(response)}", :unknown)
      end
    end

    def error_message_from(response)
      parsed = JSON.parse(response.body)
      parsed.dig("error", "message") || "no error message provided"
    rescue JSON::ParserError
      "unparseable error response"

View on GitHub (pinned to e69894adb9)

Solutions

  1. Upgrade the Redbark plan to one that includes API access
  2. Verify in the Redbark dashboard that the key's account has API entitlement enabled
  3. Contact Redbark support to confirm entitlement status if the dashboard looks correct
  4. Until fixed, disable the Redbark sync job so it stops failing on every run
Defensive patterns

Strategy: try-catch

Type guard

def redbark_forbidden?(error)
  error.is_a?(Provider::Redbark::AuthenticationError) && error.error_type == :access_forbidden
end

Try / catch

begin
  redbark.list_connections
rescue Provider::Redbark::AuthenticationError => e
  raise unless e.error_type == :access_forbidden
  pause_redbark_sync!(reason: "plan_not_entitled") # every endpoint will fail until plan changes
end

Prevention

When it happens

Trigger: Any authenticated Redbark call with a key whose subscription tier excludes API access — e.g. a free/UI-only plan key used against api.redbark.com.

Common situations: Trial expired and dropped to a non-API tier; API entitlement removed in a billing change; using a personal-tier key for a production integration.

Understand the failure class

Related errors


AI-assisted analysis of we-promise/sure@e69894adb9 (2026-08-21). Data as JSON: /api/errors/ce2ff1cc1cb4863d. Report an issue: GitHub.