Stirling-Tools/Stirling-PDF · error · Error

The server processed the request but returned no files.

Error message

The server processed the request but returned no files.

What it means

Thrown by the multiFile-endpoint branch of useToolOperation after the response is parsed into processedFiles (via responseHandler, zip extraction, or single-file wrapping) and the result is an empty array. The server returned 2xx with a body, but that body yielded zero usable output files — treated as a protocol/empty-output failure.

Source

Thrown at frontend/editor/src/core/hooks/tools/shared/useToolOperation.ts:312

              );
            } else if (
              await zipFileService.isZipResponse(
                responseBlob,
                typeof contentTypeHeader === "string"
                  ? contentTypeHeader
                  : undefined,
              )
            ) {
              processedFiles = await extractZipFiles(responseBlob);
            } else {
              const filename = `${config.filePrefix}${filesForAPI[0]?.name || "document.pdf"}`;
              processedFiles = [
                new File([responseBlob], filename, { type: "application/pdf" }),
              ];
            }

            if (processedFiles.length === 0) {
              throw new Error(
                "The server processed the request but returned no files.",
              );
            }

            // Assume all inputs succeeded together unless server provided an error earlier
            successSourceIds = validFiles.map((f) => f.fileId);
            break;
          }

          case ToolType.custom: {
            actions.setStatus("Processing files...");
            const result = await config.customProcessor(params, filesForAPI);

            processedFiles = result.files;
            const consumedAllInputs = result.consumedAllInputs || false;

            // If consumedAllInputs flag is set, mark all inputs as successful
            // (used for operations that combine N inputs into fewer outputs)

View on GitHub (pinned to 9ef20dcab8)

Solutions

  1. Inspect the raw responseBlob size and Content-Type for the failing call (log before the length check).
  2. Validate inputs (page ranges, selected files) before the call so operations that would produce nothing are rejected up front.
  3. If the backend legitimately returns empty for a no-op case, convert this to an onStatus warning instead of throwing.
  4. Add backend-side guarantees that success responses always contain at least one file.

Example fix

// before
if (processedFiles.length === 0) {
  throw new Error("The server processed the request but returned no files.");
}

// after — include endpoint + size for diagnosis
if (processedFiles.length === 0) {
  throw new Error(`The server processed the request but returned no files (${config.endpoint}, ${responseBlob.size} bytes).`);
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate inputs that could legitimately produce no output before the call
if (operationType === "split" && isEmptyPageRange(params.pageRanges)) {
  // reject up front with 'select at least one page'
}

Try / catch

try {
  await runOperation();
} catch (e) {
  if (e instanceof Error && e.message === "The server processed the request but returned no files.") {
    // log responseBlob size/type, check backend for empty-body bug
    toast.error("The operation produced no output. Try different settings.");
  } else throw e;
}

Prevention

When it happens

Trigger: Backend returned 200 with an empty body or a zip containing zero entries; a tool-specific responseHandler returned [] due to an internal filter; zip extraction succeeded but produced no files; the response blob was 0 bytes.

Common situations: Endpoint bug returning empty content on success; a filter inside responseHandler dropping all outputs; an operation that legitimately produced nothing (e.g. split with an empty page range) not being validated up front.

Related errors


AI-assisted analysis of Stirling-Tools/Stirling-PDF@9ef20dcab8 (2026-08-13). Data as JSON: /api/errors/41d42c946289cd82. Report an issue: GitHub.