oraios/serena · error · SolidLSPException

Error extracting archive.

Error message

Error extracting archive.

What it means

Generic wrapper raised by download_and_extract_archive_verified: any exception during download extraction (including the unknown-archive-type error, IO errors, or corrupt archives) is caught and re-raised as SolidLSPException("Error extracting archive.") with the original as __cause__. The real reason is in the log line 'Error extracting archive obtained from ...' and the chained exception.

Source

Thrown at src/solidlsp/ls_utils.py:540

                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.
        """
        sha256_hash = hashlib.sha256()
        with open(file_path, "rb") as input_file:
            for chunk in iter(lambda: input_file.read(8192), b""):

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Read the chained cause (__cause__) and the log message to find the underlying failure
  2. Re-run the download after verifying network/proxy returns the real archive bytes
  3. Check write permissions and free space on the target directory
  4. If it is the unknown-type cause, fix the archive_type argument

Example fix

try:
    download_to(url, dest)
except SolidLSPException as e:
    print("root cause:", e.__cause__)
Defensive patterns

Strategy: try-catch

Validate before calling

import zipfile, tarfile
with open(local_file, "rb") as f:
    magic = f.read(4)
if not (magic.startswith(b"PK") or magic.startswith(b"\x1f\x8b") or magic == b"ustar"):
    raise ValueError("downloaded file is not a known archive format")

Try / catch

try:
    download_and_extract_archive_verified(url, target, archive_type="zip")
except SolidLSPException as e:
    logger.exception("extract failed, cause=%s", e.__cause__)
    # cleanup partial target dir, then retry or abort

Prevention

When it happens

Trigger: Any download_and_extract_archive_verified call (via download_to, _download_al_extension, _install_shellcheck_if_missing, _install_from_url, _download_nuget_package, _setup_runtime_dependencies) where extraction fails: unknown archive type, corrupt/partial download, disk full, permission denied on target path.

Common situations: Corporate proxy returning an HTML error page instead of the archive; interrupted download; installing a language server in a read-only install directory.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/79b796d0060f7e36. Report an issue: GitHub.