diff --git a/context/context.go b/context/context.go
index <HASH>..<HASH> 100644
--- a/context/context.go
+++ b/context/context.go
@@ -451,6 +451,10 @@ func (ctx *Context) ModifyImport(ps *pkgspec.Pkg, mod Modify) error {
 		}
 	}
 
+	if canonicalImportPath == "" {
+		canonicalImportPath = sourcePath
+	}
+
 	// Does the local import exist?
 	//   If so either update or just return.
 	//   If not find the disk path from the canonical path, copy locally and rewrite (if needed).
context: fix setting path when it doesn't exist anywhere yet