BatchCompletedWithErrors
Event v216 → v247, v252 → v265, v273 → v277, v290 → v315, v320 → v326, v334 → v367, v372 → v377, v385 → v402, v411 → current Changed in v411 #88Emitted when a batch operation completes but some items failed.
View events on chainThe Big Picture
Not every batch operation is all-or-nothing. Some complete partially - some items succeed, others fail. This event signals that your batch finished but had problems. It's a yellow flag: mostly worked, but check the details. Pair with BatchWeightItemFailed events to understand exactly what failed and why.
Why This Matters
A batch that partially fails is worse than one that completely fails (which you'd notice immediately). This event warns you: 'Something went wrong, check the details.' Without this, you might think everything succeeded when actually some subnets didn't get updated.
Example Scenario
You batch weights for 10 subnets. 8 succeed, 2 fail. BatchCompletedWithErrors fires, signaling partial failure. You check BatchWeightItemFailed events and see subnets 5 and 9 failed (rate limited and not registered, respectively). Your automation retries those two specifically.
Common Questions
- Is partial success good or bad?
- Depends on your needs. Getting 8/10 subnets updated is better than 0/10, but you have incomplete state. Treat as 'needs attention' - review and fix the failures.
- How do I know which items succeeded vs failed?
- Look for BatchWeightItemFailed events for failures. Items without failure events succeeded. You can also check each subnet's weight state directly.
- Should I retry the whole batch or just failures?
- Just the failures. Retrying succeeded items wastes resources and might hit rate limits. Build retry logic that targets specific failed items.
Use Cases
- Detect partial batch success/failure
- Trigger follow-up actions for failed items
- Track batch reliability metrics
- Build robust batch operation handling
How to Use This Event
- → Monitor for partial batch failures
- → Build alerting for mixed success/failure batches
- → Track success rates across batch operations
From Chain Metadata
A batch extrinsic completed but with some errors.
Triggers
Emitted by
Preconditions
- Batch operation executed
- At least one item failed
Effects
Storage Modified
Postconditions
- Successful items applied
- Failed items skipped
Side Effects
- Check BatchWeightItemFailed for specific errors
This event has no data fields.
Code Examples
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Subscribe to BatchCompletedWithErrors events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.SubtensorModule.BatchCompletedWithErrors.get(block.hash);
for (const evt of events) {
console.log("BatchCompletedWithErrors:", evt.payload);
}
});Version History
Runtime Info
View Source- Pallet Index
- 7
- Event Index
- 88
- First Version
- v216
- Current Version
- v411