Tencent/WeKnora · error
invalid %s: %w
Error message
invalid %s: %w
What it means
Wrapping error in ParseAgentSourceTenantID when the agent_source_tenant_id parameter is non-empty but strconv.ParseUint rejects it (negative, non-numeric, or out of uint64 range). Empty input means absent; invalid input fails closed so callers never silently fall back to a default workspace.
Source
Thrown at internal/types/agent_share_source.go:21
import (
"fmt"
"strconv"
"strings"
)
const AgentSourceTenantIDParam = "agent_source_tenant_id"
// ParseAgentSourceTenantID parses the optional shared-agent source workspace selector.
// Empty or whitespace input is treated as absent (0, nil). Non-empty but invalid
// values return an error so callers fail closed instead of silently falling back.
func ParseAgentSourceTenantID(raw string) (uint64, error) {
raw = strings.TrimSpace(raw)
if raw == "" {
return 0, nil
}
value, err := strconv.ParseUint(raw, 10, 64)
if err != nil {
return 0, fmt.Errorf("invalid %s: %w", AgentSourceTenantIDParam, err)
}
return value, nil
}
View on GitHub (pinned to 988cbb0330)
Solutions
- Pass a valid unsigned integer tenant ID
- Omit the parameter to indicate 'no source workspace'
- Sanitize the client input before forwarding
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/types/agent_share_source.go:21 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/fe85d4b3804a3251.
Report an issue: GitHub.