CanineHQ/canine · error · Portainer::Client::UnauthorizedError

Unauthorized to access Portainer

Error message

Unauthorized to access Portainer

What it means

Error "Unauthorized to access Portainer" thrown in CanineHQ/canine.

Source

Thrown at lib/portainer/client.rb:170

  private

    def headers
      @headers ||= {
        'Content-Type' => 'application/json'
      }.tap do |headers|
        if jwt.is_a?(UserJWT)
          headers['Authorization'] = "Bearer #{jwt.token}"
        else
          headers['X-API-Key'] = jwt.token
        end
      end
    end

    def fetch_wrapper(&block)
      response = yield

      raise UnauthorizedError, "Unauthorized to access Portainer" if response.code == 401
      raise PermissionDeniedError, "Permission denied to access Portainer" if response.code == 403

      if response.success?
        response.parsed_response
      else
        raise "Failed to fetch from Portainer: #{response.code} #{response.body}"
      end
    end
  end
end

View on GitHub (pinned to ba4ee3968d)

When it happens

Trigger: Thrown at lib/portainer/client.rb:170 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of CanineHQ/canine@ba4ee3968d (2026-08-23). Data as JSON: /api/errors/22d06942f1f1677f. Report an issue: GitHub.