{"record":{"id":"ab77af324799600a","repo":"wavetermdev/waveterm","slug":"error-parsing-destination-connection-w","errorCode":null,"errorMessage":"error parsing destination connection: %w","messagePattern":"error parsing destination connection: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/remote/fileshare/wshfs/wshfs.go","lineNumber":228,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\treturn wshclient.RemoteMkdirCommand(RpcClient, conn.Path, &wshrpc.RpcOpts{Route: wshutil.MakeConnectionRouteId(conn.Host)})\n}\n\nfunc Move(ctx context.Context, data wshrpc.CommandFileCopyData) error {\n\topts := data.Opts\n\tif opts == nil {\n\t\topts = &wshrpc.FileCopyOpts{}\n\t}\n\tlog.Printf(\"Move: srcuri: %v, desturi: %v, opts: %v\", data.SrcUri, data.DestUri, opts)\n\tsrcConn, err := parseConnection(ctx, data.SrcUri)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error parsing source connection: %w\", err)\n\t}\n\tdestConn, err := parseConnection(ctx, data.DestUri)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error parsing destination connection: %w\", err)\n\t}\n\tif srcConn.Host != destConn.Host {\n\t\tisDir, err := copyInternal(srcConn, destConn, opts)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot copy %q to %q: %w\", data.SrcUri, data.DestUri, err)\n\t\t}\n\t\treturn delete_(srcConn, opts.Recursive && isDir)\n\t}\n\treturn moveInternal(srcConn, destConn, opts)\n}\n\nfunc Copy(ctx context.Context, data wshrpc.CommandFileCopyData) error {\n\topts := data.Opts\n\tif opts == nil {\n\t\topts = &wshrpc.FileCopyOpts{}\n\t}\n\tlog.Printf(\"Copy: srcuri: %v, desturi: %v, opts: %v\", data.SrcUri, data.DestUri, opts)\n\tsrcConn, err := parseConnection(ctx, data.SrcUri)","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/remote/fileshare/wshfs/wshfs.go#L210-L246","documentation":"wshfs.Move wraps the error returned by connparse's parseConnection when the DESTINATION URI of a file move cannot be parsed into a valid connection (scheme + host + path). The library throws it because Move must route the file operation RPC to the destination's host, which is impossible without a parsed connection. The underlying parse error is preserved via %w for inspection with errors.Is/As.","triggerScenarios":"Calling wshfs.Move (via FileMoveCommand RPC) with a data.DestUri that is empty, malformed (e.g. missing 'conn:' scheme or host component), or references an unknown/unregistered connection profile.","commonSituations":"Typing a destination path without a connection prefix in the Wave file manager; a saved connection was deleted or renamed so the URI's host no longer resolves; programmatic callers building CommandFileCopyData by hand with a wrong DestUri format.","solutions":["Check the destination URI string passed to Move and make sure it is a full connection URI (e.g. conn:local:///path or conn:<profilename>://path), not a bare filesystem path.","Call connparse.ParseConnection (or equivalent) on the DestUri before invoking Move and inspect the wrapped error to see which URI component failed.","Verify the connection referenced by DestUri still exists in the connection settings; re-add or rename it if it was deleted."],"exampleFix":"// before\nwshfs.Move(ctx, wshrpc.CommandFileCopyData{SrcUri: \"conn:local:///a.txt\", DestUri: \"/tmp/b.txt\"})\n// after\nwshfs.Move(ctx, wshrpc.CommandFileCopyData{SrcUri: \"conn:local:///a.txt\", DestUri: \"conn:local:///tmp/b.txt\"})","handlingStrategy":"validation","validationCode":"if _, err := connparse.ParseConnection(ctx, data.DestUri); err != nil {\n    return fmt.Errorf(\"invalid DestUri %q: %w\", data.DestUri, err)\n}\n// then call wshfs.Move","typeGuard":null,"tryCatchPattern":"if err := wshfs.Move(ctx, data); err != nil {\n    var perr *connparse.ParseError\n    if errors.As(err, &perr) { /* bad DestUri format */ }\n}","preventionTips":["Always build URIs with the connection prefix (conn:<host>://path), never bare paths.","Validate URIs through the same parser the library uses before calling Move.","Keep connection profile names in sync with the URIs you persist."],"tags":["file-transfer","uri-parsing","go"],"backgroundTag":"invalid-connection-uri","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}