{"record":{"id":"fe85d4b3804a3251","repo":"Tencent/WeKnora","slug":"invalid-s-w","errorCode":null,"errorMessage":"invalid %s: %w","messagePattern":"invalid (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/types/agent_share_source.go","lineNumber":21,"sourceCode":"import (\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n)\n\nconst AgentSourceTenantIDParam = \"agent_source_tenant_id\"\n\n// ParseAgentSourceTenantID parses the optional shared-agent source workspace selector.\n// Empty or whitespace input is treated as absent (0, nil). Non-empty but invalid\n// values return an error so callers fail closed instead of silently falling back.\nfunc ParseAgentSourceTenantID(raw string) (uint64, error) {\n\traw = strings.TrimSpace(raw)\n\tif raw == \"\" {\n\t\treturn 0, nil\n\t}\n\tvalue, err := strconv.ParseUint(raw, 10, 64)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"invalid %s: %w\", AgentSourceTenantIDParam, err)\n\t}\n\treturn value, nil\n}\n","sourceCodeStart":3,"sourceCodeEnd":25,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/types/agent_share_source.go#L3-L25","documentation":"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.","triggerScenarios":"Thrown at internal/types/agent_share_source.go:21 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a valid unsigned integer tenant ID","Omit the parameter to indicate 'no source workspace'","Sanitize the client input before forwarding"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}