oraios/serena · error · SolidLSPException
Unknown archive type '{archive_type}'
Error message
Unknown archive type '{archive_type}' What it means
Raised by download_and_extract_archive_verified when the archive_type argument is neither a recognized archive format (zip, tar.*) nor "binary". The library cannot know how to extract an unclassified file, so it aborts the whole download/extract operation and wraps this in a generic SolidLSPException("Error extracting archive.") which is what callers usually see.
Source
Thrown at src/solidlsp/ls_utils.py:537
tmp_file_name_ungzipped = tmp_file_name + ".zip"
with gzip.open(tmp_file_name, "rb") as f_in, open(tmp_file_name_ungzipped, "wb") as f_out:
shutil.copyfileobj(f_in, f_out)
FileUtils._extract_zip_archive(tmp_file_name_ungzipped, target_path)
elif archive_type == "gz":
target_directory = os.path.dirname(target_path) or "."
os.makedirs(target_directory, exist_ok=True)
temp_output_path = str(PurePath(target_directory, f".{Path(target_path).name}.{uuid.uuid4().hex}.extract"))
external_tmp_files.append(temp_output_path)
with gzip.open(tmp_file_name, "rb") as f_in, open(temp_output_path, "wb") as f_out:
shutil.copyfileobj(f_in, f_out)
os.replace(temp_output_path, target_path)
elif archive_type == "binary":
target_directory = os.path.dirname(target_path) or "."
os.makedirs(target_directory, exist_ok=True)
shutil.move(tmp_file_name, target_path)
else:
log.error(f"Unknown archive type '{archive_type}' for extraction")
raise SolidLSPException(f"Unknown archive type '{archive_type}'")
except Exception as exc:
log.error(f"Error extracting archive obtained from '{url}': {exc}")
raise SolidLSPException("Error extracting archive.") from exc
finally:
# cleaning up any temporary files outside the temporary directory
for tmp_file in external_tmp_files:
if os.path.exists(tmp_file):
Path.unlink(Path(tmp_file))
# removing the temporary directory
if tmp_dir is not None:
shutil.rmtree(tmp_dir, ignore_errors=True)
@staticmethod
def calculate_sha256(file_path: str) -> str:
"""
Calculates the SHA256 checksum of a file.
"""View on GitHub (pinned to 7fcbca7e62)
Solutions
- Check the archive_type value passed by the code path you control; use "binary" if the file is not an archive, or a supported archive type string
- Verify the downloaded file actually has the expected extension/format; a failed download often yields a non-archive file
- If you own the download URL, rename the artifact to use a recognized extension (.zip, .tar.gz)
Example fix
// before download_and_extract_archive_verified(url, target, archive_type="zipfile") // after download_and_extract_archive_verified(url, target, archive_type="zip")
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED = {"zip", "tar", "tar.gz", "tar.bz2", "binary"}
if archive_type not in SUPPORTED:
raise ValueError(f"archive_type must be one of {SUPPORTED}, got {archive_type!r}") Type guard
def is_valid_archive_type(t: str) -> bool:
return t in {"zip", "tar", "tar.gz", "tar.bz2", "binary"} Try / catch
try:
download_and_extract_archive_verified(url, target, archive_type=archive_type)
except SolidLSPException as e:
logger.error("download/extract failed: %s", e.__cause__)
raise Prevention
- Pass archive_type literally as "binary" for non-archive files
- Use file extensions from the library's recognized set
- Log the URL and final filename to spot unexpected artifacts
When it happens
Trigger: Calling download_and_extract_archive_verified (directly or via download_to, _install_from_url, _download_nuget_package, _setup_runtime_dependencies, etc.) with archive_type set to a value other than "binary" or a supported archive extension, e.g. a typo like "zip" vs an unrecognized extension or an empty string.
Common situations: Configuring a custom language-server download URL whose file extension is not in the extractor's mapping (e.g. .tgz spelled oddly, .pkg, no extension at all); a server redirects to an HTML error page saved with an unknown name.
Related errors
- Error extracting archive.
- Refusing to download from host '{hostname or '<unknown>'}';
- Dashboard is not running.
- Cannot activate project '{project.project_name}': it require
- Project '{project_root_or_name}' not found: Not a valid proj
AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29).
Data as JSON: /api/errors/b54ad8bca00bd7e0.
Report an issue: GitHub.