Dokploy/dokploy · warning · Error

File is too large to save from the editor (max 512KB)

Error message

File is too large to save from the editor (max 512KB)

What it means

Thrown when saving a file from the Dokploy editor into a container: the UTF-8 content, once base64-encoded, exceeds CONTAINER_FILE_SIZE_LIMIT * 2 bytes (base64 is ~4/3 the size of the raw content, so the effective raw limit is 512KB). This is a deliberate guard so the generated shell printf/base64 pipeline stays within ARG_MAX and docker cp limits.

Source

Thrown at packages/server/src/services/docker.ts:841

		throw new Error(stderr);
	}

	const buffer = Buffer.from(stdout.trim(), "base64");
	return {
		content: buffer.subarray(0, CONTAINER_FILE_SIZE_LIMIT).toString("base64"),
		truncated: buffer.byteLength > CONTAINER_FILE_SIZE_LIMIT,
	};
};

export const writeContainerFile = async (
	containerId: string,
	filePath: string,
	content: string,
	serverId?: string,
) => {
	const base64Content = Buffer.from(content, "utf8").toString("base64");
	if (base64Content.length > CONTAINER_FILE_SIZE_LIMIT * 2) {
		throw new Error("File is too large to save from the editor (max 512KB)");
	}

	const tempPath = `/tmp/dokploy-edit-${Date.now()}-${Math.random().toString(36).slice(2)}`;
	const command = `printf '%s' ${quote([base64Content])} | base64 -d > ${quote([tempPath])} && docker cp ${quote([tempPath])} ${quote([`${containerId}:${filePath}`])}; status=$?; rm -f ${quote([tempPath])}; exit $status`;

	if (serverId) {
		await execAsyncRemote(serverId, command);
	} else {
		await execAsync(command);
	}
};

export const deleteContainerFile = async (
	containerId: string,
	path: string,
	serverId?: string,
) => {
	const command = `docker exec ${quote([containerId])} rm -rf ${quote([path])}`;

View on GitHub (pinned to 546686ea35)

Solutions

  1. Edit the file outside the editor (docker cp it out, edit locally, docker cp back)
  2. Reduce the file content below 512KB before saving
  3. If you own the deployment, raise CONTAINER_FILE_SIZE_LIMIT and rebuild the server, understanding shell ARG_MAX constraints

Example fix

// before
await saveFileToContainer(containerId, filePath, hugeContent, serverId);
// after
// stream via docker cp instead of the editor for large files
await execAsync(`docker cp ${localLargeFile} ${containerId}:${filePath}`);
Defensive patterns

Strategy: validation

Validate before calling

const MAX = 512 * 1024;
if (Buffer.byteLength(content, 'utf8') > MAX) throw new RangeError('use docker cp for large files');

Try / catch

try { await saveFileToContainer(id, path, content, serverId); }
catch (e) { if ((e as Error).message.includes('too large')) { /* docker cp fallback */ } throw e; }

Prevention

When it happens

Trigger: Calling saveFileToContainer (editor save endpoint) with content whose base64 representation exceeds ~1MB (raw content > 512KB), e.g. pasting a large JSON/CSV/lockfile into the editor and hitting save.

Common situations: Editing generated files like package-lock.json, minified bundles, or dataset files in the built-in editor; machine-generated content pasted in exceeds the cap even though the on-disk file was small when opened truncated.

Related errors


AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27). Data as JSON: /api/errors/bfb93796913f7843. Report an issue: GitHub.