diff --git a/.changes/next-release/bugfix-6a2d9629-1cc1-4143-8950-cfd117fcabe3.json b/.changes/next-release/bugfix-6a2d9629-1cc1-4143-8950-cfd117fcabe3.json new file mode 100644 index 0000000000..e6919a2171 --- /dev/null +++ b/.changes/next-release/bugfix-6a2d9629-1cc1-4143-8950-cfd117fcabe3.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Amazon Q /dev: Fix issue when files are deleted while preparing context" +} \ No newline at end of file diff --git a/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/FeatureDevSessionContext.kt b/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/FeatureDevSessionContext.kt index 98a0f92f08..214b837bd9 100644 --- a/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/FeatureDevSessionContext.kt +++ b/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/FeatureDevSessionContext.kt @@ -189,8 +189,12 @@ class FeatureDevSessionContext(val project: Project, val maxProjectSizeBytes: Lo createTemporaryZipFileAsync { zipOutput -> filesToIncludeFlow.collect { file -> - val relativePath = Path(file.path).relativeTo(projectRoot.toNioPath()) - zipOutput.putNextEntry(relativePath.toString(), Path(file.path)) + try { + val relativePath = Path(file.path).relativeTo(projectRoot.toNioPath()) + zipOutput.putNextEntry(relativePath.toString(), Path(file.path)) + } catch (e: NoSuchFileException) { + // Noop: Skip if file was deleted + } } } }.toFile()