{"record":{"id":"fb66b4bf4fc4159f","repo":"anomalyco/sst","slug":"invalid-archive-name-format-s","errorCode":null,"errorMessage":"invalid archive name format: %s","messagePattern":"invalid archive name format: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/build.go","lineNumber":331,"sourceCode":"\t\t\treturn fmt.Errorf(\"failed to extract wheel: %w\", err)\n\t\t}\n\n\t\tos.Remove(archiveFile)\n\n\t\treturn nil\n\t}\n\n\t// Extract tar.gz\n\tif err := extractTarGz(archiveFile, outputDir); err != nil {\n\t\treturn fmt.Errorf(\"failed to extract archive: %w\", err)\n\t}\n\n\t// Get the directory name without version number\n\tarchiveBaseName := filepath.Base(archiveFile)\n\tdirName := strings.TrimSuffix(archiveBaseName, \".tar.gz\")\n\tlastHyphen := strings.LastIndex(dirName, \"-\")\n\tif lastHyphen == -1 {\n\t\treturn fmt.Errorf(\"invalid archive name format: %s\", archiveBaseName)\n\t}\n\n\tbaseName := dirName[:lastHyphen]\n\textractedDir := filepath.Join(outputDir, dirName)\n\ttargetDir := filepath.Join(outputDir, baseName)\n\n\t// Move extracted directory to target\n\tif err := moveExtractedPackage(extractedDir, targetDir, baseName); err != nil {\n\t\treturn fmt.Errorf(\"failed to move extracted package: %w\", err)\n\t}\n\n\t// Remove the original archive\n\tos.Remove(archiveFile)\n\n\treturn nil\n}\n\n// extractZip extracts a zip archive (used for .whl files) to the destination directory.","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/build.go#L313-L349","documentation":"After extracting a .tar.gz sdist, the code strips `.tar.gz` and splits the remaining name on the last hyphen to derive `pkgname-version`. If the filename has no hyphen at all, the package directory cannot be inferred and this error is thrown.","triggerScenarios":"An archive whose base name contains no `-` (e.g. `package.tar.gz`) was present in the build output and matched one of the glob patterns.","commonSituations":"A manually created or renamed sdist placed in the build dir (e.g. `mypkg.tar.gz` from `python setup.py sdist` with no version); odd single-token package names.","solutions":["Rename the archive to the standard `name-version.tar.gz` sdist layout (e.g. `mypkg-1.0.0.tar.gz`)","Ensure the file was produced by pip, not hand-built, and let pip regenerate it in a clean build","Remove stray non-pip archives from the build output directory"],"exampleFix":"// before: build dir contains mypkg.tar.gz\nmv mypkg.tar.gz mypkg-1.0.0.tar.gz\n// after: glob/derived baseName = \"mypkg\", extraction proceeds","handlingStrategy":"validation","validationCode":"const base = archivePath.split(\"/\").pop()!;\nif (!/^.+-[^-]+\\.tar\\.gz$/.test(base)) throw new Error(`${base} is not name-version.tar.gz`);","typeGuard":null,"tryCatchPattern":"try {\n  await buildPackage(...);\n} catch (e) {\n  if (String(e).includes(\"invalid archive name format\")) {\n    console.error(\"Rename archive to <name>-<version>.tar.gz:\", e);\n  }\n  throw e;\n}","preventionTips":["Only place pip-produced archives in the build dir","Always name sdists as `<name>-<version>.tar.gz`","Don't manually rename or hand-build archives into the output directory"],"tags":["python","sdist","naming","archive"],"backgroundTag":"invalid-archive-name","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}