π Bug: Incorrect Governance Model Matching Causes Registration Failures #438
π Bug Report: Incorrect Governance Model Matching in API
Severity: Medium
Category: Bug Discovery + Improvement Proposal
Bounty Program: Yes (Discord Announcement)
Reporter: @Asplana92
Date Discovered: November 15, 2025
Block Height: ~1,304,000 - 1,305,300
π― TL;DR / Summary
The API uses prefix-matching instead of exact-matching when searching for governance models, causing name collisions and blocking hardware registration.
Impact:
- β Prevents hardware registration when model names overlap
- β±οΈ ~2 hours debugging time per affected operator
- π 100% reproducible
- π Affects any host using models with similar prefixes
π Problem Description
Current Behavior (Incorrect)
When registering hardware, the API searches for governance models using substring/prefix matching instead of exact model ID comparison.
Example collision:
User's node-config.json:
{
"models": {
"Qwen/Qwen2.5-7B-Instruct": {"args": []}
}
}
API logic:
1. Searches for "Qwen/Qwen2.5-7B-Instruct" in governance models
2. Finds "RedHatAI/Qwen2.5-7B-Instruct-quantized.w8a16"
(contains substring "Qwen2.5-7B-Instruct")
3. Uses WRONG model ID: "RedHatAI/Qwen2.5-7B-Instruct-quantized.w8a16"
4. Tries to register hardware with this model
5. β ERROR: "Failed to get governance models: model not found"
Expected Behavior
The API should use exact model ID matching:
// CORRECT approach
function findGovernanceModel(modelId, governanceModels) {
const exactMatch = governanceModels.find(m => m.id === modelId)
if (!exactMatch) {
const available = governanceModels.map(m => m.id).join('\n - ')
throw new Error(
`Model '${modelId}' not found in governance.\n` +
`Available models:\n - ${available}`
)
}
return exactMatch
}
π Error Logs
2025/11/15 16:21:34 INFO RegisterNode. Governance model
model_id=RedHatAI/Qwen2.5-7B-Instruct-quantized.w8a16
2025/11/15 16:22:50 ERROR Failed to get governance models:
model not found for RedHatAI/Qwen2.5-7B-Instruct-quantized.w8a16
What happened:
1. β
User configured Qwen/Qwen2.5-7B-Instruct
2. β API found RedHatAI/Qwen2.5-7B-Instruct-quantized.w8a16 (prefix match)
3. β Tried to register with wrong model ID
4. β Registration failed
π Reproduction Steps
Prerequisites
- Fresh Gonka node setup
- Governance models containing similar names:
Qwen/Qwen2.5-7B-InstructRedHatAI/Qwen2.5-7B-Instruct-quantized.w8a16
Steps to Reproduce
-
Configure node with specific model:
-
Start API:
-
Observe error:
-
Expected: API should register
Qwen/Qwen2.5-7B-Instruct
Actual: API tries to registerRedHatAI/Qwen2.5-7B-Instruct-quantized.w8a16
π₯ Impact Assessment
Who is Affected
- β Any host using models with similar name prefixes
- β New operators setting up nodes for the first time
- β Production deployments with specific model requirements
Common Collision Examples
Base Model Collides With
βββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββ
Qwen/Qwen2.5-7B β RedHatAI/Qwen2.5-7B-Instruct-quantized
Llama-3.1-8B β Llama-3.1-8B-Instruct-Turbo
Mistral-7B β Mistral-7B-Instruct-v0.3
Business Impact
- π Prevents new hosts from joining (reduces network decentralization)
- β±οΈ 2-4 hours debugging time per affected operator
- π Poor onboarding experience for new participants
- β Blocks hardware registration until workaround is found
Severity Justification
- Medium Severity because:
- β Workaround exists (use exact model ID)
- β Not documented anywhere
- β Blocks critical functionality (hardware registration)
- β 100% reproducible
π‘ Proposed Solution
Option 1: Exact Matching (Recommended) β
/**
* Find governance model by exact ID match
* @param {string} modelId - Model ID from node-config.json
* @param {Array} governanceModels - Models from blockchain
* @returns {Object} Matched governance model
* @throws {Error} If model not found or multiple matches
*/
function findGovernanceModel(modelId, governanceModels) {
// EXACT match only
const exactMatch = governanceModels.find(m => m.id === modelId)
if (exactMatch) {
return exactMatch
}
// Helpful error message with available models
const available = governanceModels
.map(m => ` - ${m.id}`)
.join('\n')
throw new Error(
`Governance model '${modelId}' not found.\n\n` +
`Available models:\n${available}\n\n` +
`Please use exact model ID from the list above.`
)
}
Benefits: - β Prevents name collisions - β Clear error messages - β Lists available models for easy copy-paste - β Backward compatible (exact matches still work)
Option 2: Ambiguity Detection
/**
* Find governance model with collision detection
*/
function findGovernanceModelSafe(modelId, governanceModels) {
// Check for exact match first
const exactMatch = governanceModels.find(m => m.id === modelId)
if (exactMatch) {
return exactMatch
}
// Check for prefix collisions
const prefixMatches = governanceModels.filter(m =>
m.id.includes(modelId) || modelId.includes(m.id)
)
if (prefixMatches.length > 1) {
throw new Error(
`Ambiguous model ID '${modelId}'. Multiple matches found:\n` +
prefixMatches.map(m => ` - ${m.id}`).join('\n') +
`\n\nPlease use exact model ID.`
)
}
if (prefixMatches.length === 1) {
console.warn(
`WARNING: Using prefix match for '${modelId}' β '${prefixMatches[0].id}'. ` +
`Consider using exact model ID.`
)
return prefixMatches[0]
}
throw new Error(`Model '${modelId}' not found in governance.`)
}
Benefits: - β Detects collisions explicitly - β Backward compatible with fuzzy matching - β οΈ More complex logic
β Workaround (Current)
Until fixed, operators can work around this issue:
-
Query available governance models:
-
Use EXACT model ID in config:
-
Verify no similar names exist:
π§ͺ Testing Environment
Setup: - Server: Hetzner Cloud, Ubuntu 22.04 LTS - Docker: 27.3.1 - Network: gonka-mainnet - Block Height: ~1,304,000 - 1,305,300 - API Version: Latest (from docker-compose.yml)
Governance Models Present:
π° Bounty Program Alignment
Per Gonka Bounty Program Discord Announcement:
Vulnerability Bounty Program:
- Describing an unknown vulnerability: 1,000-5,000 gonka coins
- Proposal describing additional improvement: 1,000-5,000 gonka coins
This Submission Includes:
β
Bug discovery and description
β
Root cause analysis (prefix vs exact matching)
β
Proposed solution with code examples
β
Reproduction steps (100% reproducible)
β
Impact assessment (affects all similar model names)
β
Workaround documentation
Optional PR
Happy to implement Option 1 (Exact Matching) if the team approves this approach! π
π Discovery Timeline
| Time | Event |
|---|---|
| Nov 15, 16:26 | Started hardware registration |
| Nov 15, 16:45 | Encountered error (wrong model ID) |
| Nov 15, 17:20 | Identified root cause (prefix matching) |
| Nov 15, 17:40 | Implemented workaround (exact model ID) |
| Nov 15, 18:00 | Hardware successfully registered β |
Total debugging time: ~2 hours
Workaround difficulty: Medium (requires blockchain query knowledge)
π€ Additional Notes
- Anonymous submission: No
- Reporter: Asplana92 (Discord: @tolik_iarik)
- Contact: Available on Discord for questions
- Willing to implement fix: Yes β
- Testing availability: Can test patched builds
π Related Issues
- None found (first report of this issue)
π Acknowledgments
Thank you to the Gonka team for: - Creating the Bounty Program - Maintaining responsive Discord support - Building an open-source decentralized AI network
Looking forward to contributing to improved operator experience! π
Submitted by: @Asplana92
Date: November 15, 2025
Bounty Category: Bug Discovery + Improvement Proposal
π¬ Comments (2)
already fixed
π Auto-synced from Issue #438 every hour.
PR created: https://github.com/gonka-ai/gonka/pull/680
Improves error messages for invalid governance models.