{"record":{"id":"a29a968541ee1174","repo":"wavetermdev/waveterm","slug":"invalid-oref-string-v","errorCode":null,"errorMessage":"invalid oref string: %v","messagePattern":"invalid oref string: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/service/service.go","lineNumber":121,"sourceCode":"\tif _, ok := jsonArg.(map[string]any); !ok {\n\t\treturn nil, fmt.Errorf(\"cannot convert %T to %s\", jsonArg, argType)\n\t}\n\tcmd, err := webcmd.ParseWSCommandMap(jsonArg.(map[string]any))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing command map: %w\", err)\n\t}\n\treturn cmd, nil\n}\n\nfunc convertSpecial(argType reflect.Type, jsonArg any) (any, error) {\n\tjsonType := reflect.TypeOf(jsonArg)\n\tif argType == orefRType {\n\t\tif jsonType.Kind() != reflect.String {\n\t\t\treturn nil, fmt.Errorf(\"cannot convert %T to %s\", jsonArg, argType)\n\t\t}\n\t\toref, err := waveobj.ParseORef(jsonArg.(string))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid oref string: %v\", err)\n\t\t}\n\t\treturn oref, nil\n\t} else if argType == wsCommandRType {\n\t\treturn convertWSCommand(argType, jsonArg)\n\t} else if argType == waveObjRType {\n\t\tif jsonType.Kind() != reflect.Map {\n\t\t\treturn nil, fmt.Errorf(\"cannot convert %T to %s\", jsonArg, argType)\n\t\t}\n\t\treturn waveobj.FromJsonMap(jsonArg.(map[string]any))\n\t} else if argType == waveObjSliceRType {\n\t\tif jsonType.Kind() != reflect.Slice {\n\t\t\treturn nil, fmt.Errorf(\"cannot convert %T to %s\", jsonArg, argType)\n\t\t}\n\t\tsliceArg := jsonArg.([]any)\n\t\tnativeSlice := make([]waveobj.WaveObj, len(sliceArg))\n\t\tfor idx, elem := range sliceArg {\n\t\t\telemMap, ok := elem.(map[string]any)\n\t\t\tif !ok {","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/service/service.go#L103-L139","documentation":"Returned when a string cannot be parsed as a valid oref (object reference), such as malformed syntax or an unknown reference format. The offending input is included via %v for diagnostics.","triggerScenarios":"Passing a malformed OID string to an ORef parameter - wrong length/charset, empty string, or a 'type:oid' composite with an unknown type prefix.","commonSituations":"Truncated or whitespace-contaminated OIDs copied from logs; OIDs mangled by URL decoding; type and ID concatenated with the wrong separator.","solutions":["Read the wrapped cause for the exact parse failure.","Trim whitespace and verify the OID matches the expected Wave OID format.","Re-fetch the identifier from the backend instead of reconstructing it manually."],"exampleFix":"// before\noref, err := waveobj.ParseORef(\"  \" + oid + \":\")\n// after\noref, err := waveobj.ParseORef(strings.TrimSpace(oid))\nif err != nil {\n    return fmt.Errorf(\"bad oid %q: %v\", oid, err)\n}","handlingStrategy":"validation","validationCode":"oid = strings.TrimSpace(oid)\nif oid == \"\" {\n    return fmt.Errorf(\"empty oref\")\n}\nif _, err := waveobj.ParseORef(oid); err != nil {\n    return fmt.Errorf(\"bad oref %q: %v\", oid, err)\n}","typeGuard":null,"tryCatchPattern":"_, err := waveobj.ParseORef(s)\nif err != nil {\n    return fmt.Errorf(\"invalid oref %q: %w\", s, err)\n}","preventionTips":["Copy OIDs from APIs, not hand-edited logs or URLs.","Trim and sanitize identifiers from URL/route params.","Validate ORef format at the boundary before deeper calls."],"tags":["oref","parsing","validation","rpc"],"backgroundTag":"invalid-identifier-format","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}