gildas-lormeau/SingleFile · error · Error

Error " + response.status

Error message

Error " + response.status

What it means

upload() in the WebDAV client PUTs the file; if the PUT fails (status >= MIN_ERROR_STATUS) it attempts a DELETE to clean up the partial file, and if that DELETE also fails it throws ERROR_PREFIX_MESSAGE + response.status. So this error means both the upload and the cleanup failed, leaving the failure status of the DELETE in the message.

Source

Thrown at src/lib/webdav/webdav.js:93

	abort() {
		if (this.controller) {
			this.controller.abort();
		}
	}
}

async function upload(filename, content, options) {
	const { authorization, filenameConflictAction, prompt, signal, preventRetry } = options;
	let { url } = options;
	try {
		if (filenameConflictAction == CONFLICT_ACTION_OVERWRITE) {
			let response = await sendRequest(filename, PUT_METHOD, content);
			if (response.status == CREATED_STATUS) {
				return response;
			} else if (response.status >= MIN_ERROR_STATUS) {
				response = await sendRequest(filename, DELETE_METHOD);
				if (response.status >= MIN_ERROR_STATUS) {
					throw new Error(ERROR_PREFIX_MESSAGE + response.status);
				}
				return await upload(filename, content, options);
			}
		} else {
			let response = await sendRequest(filename, HEAD_METHOD);
			if (response.status == FOUND_STATUS) {
				if (filenameConflictAction == CONFLICT_ACTION_UNIQUIFY || (filenameConflictAction == CONFLICT_ACTION_PROMPT && !prompt)) {
					const { filenameWithoutExtension, extension, indexFilename } = splitFilename(filename);
					options.indexFilename = indexFilename + 1;
					return await upload(getFilename(filenameWithoutExtension, extension), content, options);
				} else if (filenameConflictAction == CONFLICT_ACTION_PROMPT) {
					filename = await prompt(filename);
					return filename ? upload(filename, content, options) : response;
				} else if (filenameConflictAction == CONFLICT_ACTION_SKIP) {
					return response;
				}
			} else if (response.status == NOT_FOUND_STATUS) {
				response = await sendRequest(filename, PUT_METHOD, content);

View on GitHub (pinned to 517fb7c5cf)

Solutions

  1. Check the thrown status code: fix the underlying PUT failure (credentials, quota, permissions) first — the DELETE error is secondary
  2. Verify the WebDAV account has both write (PUT) and delete (DELETE) privileges on the target collection
  3. Confirm the server URL/path and that the target collection exists and is writable
  4. If status indicates quota (507) or lock (423), free space or release locks before retrying

Example fix

// before
throw new Error(ERROR_PREFIX_MESSAGE + response.status);
// after
throw new Error(`${ERROR_PREFIX_MESSAGE} DELETE failed with ${response.status} after failed PUT of ${filename}`);
Defensive patterns

Strategy: retry

Validate before calling

if (!webdavUrl || !webdavUrl.startsWith("http")) throw new Error("Invalid WebDAV URL");
const probe = await sendRequest("", "PROPFIND");
if (probe.status === 401) throw new Error("WebDAV auth failed before upload");

Type guard

function isServerError(status) { return typeof status === "number" && status >= 400; }

Try / catch

try {
  await webdav.upload(filename, content, options);
} catch (e) {
  const status = parseStatusFromMessage(e.message);
  if (status === 423) throw new Error("File locked on WebDAV server — release lock and retry");
  if (status === 507) throw new Error("WebDAV quota exceeded");
  if (status === 401 || status === 403) throw new Error("Check WebDAV credentials/permissions (PUT and DELETE)");
  throw e;
}

Prevention

When it happens

Trigger: PUT to the WebDAV server returns an error status (auth failure, quota exceeded, read-only share); the follow-up DELETE of the same filename also returns >= MIN_ERROR_STATUS (file locked, no delete permission, path doesn't exist).

Common situations: Wrong WebDAV credentials or expired session; server quota exceeded on PUT; the account lacks DELETE permission so cleanup fails too; Nextcloud/ownCloud sharing permission restrictions; proxy returning error statuses.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of gildas-lormeau/SingleFile@517fb7c5cf (2026-09-01). Data as JSON: /api/errors/6a05669e20551448. Report an issue: GitHub.