This error was removed in v150

This error is no longer present in the current runtime. Existed from v101 to v150. Shown here for historical reference.

InvalidUid

Error Removed v101 → v120, v121 → v127, v133 → v141, v142 → v150 (removed) 7.15

The UID you specified doesn't exist on this subnet .

Encountered by: validatorsdevelopers

Why This Error Exists

When setting weights, you specify which UIDs to assign weight to. Each UID must be a valid, currently-registered neuron on that subnet. UIDs range from 0 to SubnetworkN-1, but not all may be filled if neurons were deregistered.

Deep Dive

UIDs are recycled when neurons are replaced. If SubnetworkN is 256, valid UIDs are 0-255. But if UID 42 was just pruned and not yet replaced, Keys(netuid, 42) may return None. Your weight vectors must only contain UIDs that currently have registered hotkeys. The uids[] and weights[] arrays must have matching lengths.

Debugging Example

You call set_weights(netuid=1, uids=[0, 50, 300], weights=[100, 100, 100]). Error: InvalidUid. Query SubnetworkN(1) - returns 256. UID 300 is out of range (max is 255). Fix: Remove UID 300 from your array. Also query Keys(1, 50) to ensure UID 50 is still active.

Prevention Tips

  • Fetch current neuron list with SubnetworkN before building weight vectors
  • Validate each UID exists: Keys(netuid, uid) should return a hotkey
  • Build weights fresh each epoch rather than caching stale UID lists

What This Means

The UID you specified doesn't exist on this subnet.

Common Causes

  • UID is out of range for current subnet size
  • Neuron at that UID was deregistered
  • Typo in UID parameter

How to Fix

  • Check SubtensorModule.SubnetworkN for valid UID range (0 to N-1)
  • Query SubtensorModule.Keys to verify UID exists
  • Ensure all UIDs in weight vector are valid

Storage to Check

Version History

v101 block 1 Added
v121 block 518,345 Re-added
v133 block 1,404,224 Re-added
v142 block 2,543,779 Re-added
v150 Removed

Runtime Info

Pallet Index
7
Error Index
15
Error Code
7.15
Removed In
v150