Skip to content

fix: Handle Unavailable Bittensor API Data#21

Open
RenzoMXD wants to merge 2 commits into
mainfrom
fix/api-error-states-unavailable-bittensor-data
Open

fix: Handle Unavailable Bittensor API Data#21
RenzoMXD wants to merge 2 commits into
mainfrom
fix/api-error-states-unavailable-bittensor-data

Conversation

@RenzoMXD

@RenzoMXD RenzoMXD commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

This change fixes issue #7 by adding stable backend error responses and frontend UI states for unavailable Bittensor data.
Previously, if Bittensor chain data, adapter calls, or future indexer requests failed, the backend could return a generic error and the frontend could only show a vague backend-unavailable message.
Now the API returns a typed 503 error with BITTENSOR_DATA_UNAVAILABLE, and the frontend displays a specific message: “Bittensor data is temporarily unavailable.”

Related Issue

Closes: #7

Change Type

  • Bug fix
  • UI/UX improvement
  • Backend/API improvement
  • Error handling improvement
  • Test coverage
  • New feature
  • Refactor-only change

Real Behavior Proof

Normal API behavior

curl http://localhost:4100/health

Result:

{"status":"ok","service":"tao-passport-api"}
curl http://localhost:4100/api/passport/sample

Result included:

{
  "walletAddress": "5FAbc123TAOPassportDemoWalletAddress999999999999",
  "trustScore": 89,
  "reputationSignals": [...]
}

Forced Bittensor unavailable behavior

Command used:

TAO_PASSPORT_FORCE_BITTENSOR_UNAVAILABLE=true node backend/dist/src/server.js
curl -i http://localhost:4101/api/passport/sample

Result:

HTTP/1.1 503 Service Unavailable
{
  "error": {
    "code": "BITTENSOR_DATA_UNAVAILABLE",
    "message": "Bittensor data is temporarily unavailable. Please retry after the chain adapter reconnects.",
    "retryable": true,
    "source": "bittensor"
  }
}

The same typed error behavior was also verified for:

curl -i http://localhost:4101/api/reputation/leaderboard

Checklist

  • Checked issue comments and linked discussion
  • Confirmed no issue comments were present
  • Added typed backend API error shape
  • Added Bittensor unavailable error handling
  • Returned stable 503 response for unavailable Bittensor data
  • Updated frontend API error parsing
  • Added specific unavailable-data UI message
  • Preserved existing passport data when refresh fails
  • Added backend test coverage
  • Ran build
  • Manually verified backend normal path
  • Manually verified backend unavailable-data path
  • Manually verified frontend preview

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.

Add API error states for unavailable Bittensor data

1 participant