wavetermdev/waveterm · error

error parsing destination connection: %w

Error message

error parsing destination connection: %w

What it means

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.

Source

Thrown at pkg/remote/fileshare/wshfs/wshfs.go:228

	if err != nil {
		return err
	}
	return wshclient.RemoteMkdirCommand(RpcClient, conn.Path, &wshrpc.RpcOpts{Route: wshutil.MakeConnectionRouteId(conn.Host)})
}

func Move(ctx context.Context, data wshrpc.CommandFileCopyData) error {
	opts := data.Opts
	if opts == nil {
		opts = &wshrpc.FileCopyOpts{}
	}
	log.Printf("Move: srcuri: %v, desturi: %v, opts: %v", data.SrcUri, data.DestUri, opts)
	srcConn, err := parseConnection(ctx, data.SrcUri)
	if err != nil {
		return fmt.Errorf("error parsing source connection: %w", err)
	}
	destConn, err := parseConnection(ctx, data.DestUri)
	if err != nil {
		return fmt.Errorf("error parsing destination connection: %w", err)
	}
	if srcConn.Host != destConn.Host {
		isDir, err := copyInternal(srcConn, destConn, opts)
		if err != nil {
			return fmt.Errorf("cannot copy %q to %q: %w", data.SrcUri, data.DestUri, err)
		}
		return delete_(srcConn, opts.Recursive && isDir)
	}
	return moveInternal(srcConn, destConn, opts)
}

func Copy(ctx context.Context, data wshrpc.CommandFileCopyData) error {
	opts := data.Opts
	if opts == nil {
		opts = &wshrpc.FileCopyOpts{}
	}
	log.Printf("Copy: srcuri: %v, desturi: %v, opts: %v", data.SrcUri, data.DestUri, opts)
	srcConn, err := parseConnection(ctx, data.SrcUri)

View on GitHub (pinned to a4447c1563)

Solutions

  1. 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.
  2. Call connparse.ParseConnection (or equivalent) on the DestUri before invoking Move and inspect the wrapped error to see which URI component failed.
  3. Verify the connection referenced by DestUri still exists in the connection settings; re-add or rename it if it was deleted.

Example fix

// before
wshfs.Move(ctx, wshrpc.CommandFileCopyData{SrcUri: "conn:local:///a.txt", DestUri: "/tmp/b.txt"})
// after
wshfs.Move(ctx, wshrpc.CommandFileCopyData{SrcUri: "conn:local:///a.txt", DestUri: "conn:local:///tmp/b.txt"})
Defensive patterns

Strategy: validation

Validate before calling

if _, err := connparse.ParseConnection(ctx, data.DestUri); err != nil {
    return fmt.Errorf("invalid DestUri %q: %w", data.DestUri, err)
}
// then call wshfs.Move

Try / catch

if err := wshfs.Move(ctx, data); err != nil {
    var perr *connparse.ParseError
    if errors.As(err, &perr) { /* bad DestUri format */ }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/ab77af324799600a. Report an issue: GitHub.