paperclipai/paperclip · error
Invalid log path
Error message
Invalid log path
What it means
resolveWithin path-safety guard inside the workspace operation log store: joining the provided segments and resolving them produced a path that escapes the intended root directory (or is otherwise invalid). The error protects log storage from traversal-style paths before any file is opened.
Source
Thrown at server/src/services/workspace-operation-log-store.ts:48
export interface WorkspaceOperationLogStore {
begin(input: { companyId: string; operationId: string }): Promise<WorkspaceOperationLogHandle>;
append(
handle: WorkspaceOperationLogHandle,
event: { stream: "stdout" | "stderr" | "system"; chunk: string; ts: string },
): Promise<void>;
finalize(handle: WorkspaceOperationLogHandle): Promise<WorkspaceOperationLogFinalizeSummary>;
read(handle: WorkspaceOperationLogHandle, opts?: WorkspaceOperationLogReadOptions): Promise<WorkspaceOperationLogReadResult>;
}
function safeSegments(...segments: string[]) {
return segments.map((segment) => segment.replace(/[^a-zA-Z0-9._-]/g, "_"));
}
function resolveWithin(basePath: string, relativePath: string) {
const resolved = path.resolve(basePath, relativePath);
const base = path.resolve(basePath) + path.sep;
if (!resolved.startsWith(base) && resolved !== path.resolve(basePath)) {
throw new Error("Invalid log path");
}
return resolved;
}
function createLocalFileWorkspaceOperationLogStore(basePath: string): WorkspaceOperationLogStore {
async function ensureDir(relativeDir: string) {
const dir = resolveWithin(basePath, relativeDir);
await fs.mkdir(dir, { recursive: true });
}
async function readFileRange(filePath: string, offset: number, limitBytes: number): Promise<WorkspaceOperationLogReadResult> {
const stat = await fs.stat(filePath).catch(() => null);
if (!stat) throw notFound("Workspace operation log not found");
const start = Math.max(0, Math.min(offset, stat.size));
const end = Math.max(start, Math.min(start + limitBytes - 1, stat.size - 1));
if (start > end) {View on GitHub (pinned to 120ae5428f)
Solutions
- Provide a valid log path within the allowed log directory; absolute or traversal paths are rejected.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/services/workspace-operation-log-store.ts:48 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18).
Data as JSON: /api/errors/6224506de74aee1b.
Report an issue: GitHub.