paperclipai/paperclip · error · Error
Public attempt must contain the read-only public chat projec
Error message
Public attempt must contain the read-only public chat projection
What it means
validatePublicChatPayload() first asserts that the payload really is the sanitized, read-only public projection: the publication schema constant matches PUBLIC_CHAT_SCHEMA, the view sessionId is exactly "public-report", the composer is "disabled", the connection is "closed", and devtools is null. Any miss means an unsanitized or wrong payload is about to be embedded in the public viewer, so "Public attempt must contain the read-only public chat projection" is thrown.
Source
Thrown at packages/paperclip-runner/scripts/public-eval-viewer.mjs:67
);
}
if (
![...files.keys()].some((name) => name.endsWith(".js")) ||
!index.includes('<script type="module"')
)
throw new Error("Incomplete trusted viewer build");
return { index, files };
}
export function validatePublicChatPayload(payload) {
if (
payload?.publication?.schema !== PUBLIC_CHAT_SCHEMA ||
payload.view?.sessionId !== "public-report" ||
payload.view?.composer?.state !== "disabled" ||
payload.view?.connection?.state !== "closed" ||
payload.devtools !== null
)
throw new Error(
"Public attempt must contain the read-only public chat projection",
);
const allowed = new Set([
"attemptId",
"caseId",
"disposition",
"passed",
"checks",
"view",
"devtools",
"navigation",
"run",
"publication",
]);
if (Object.keys(payload).some((key) => !allowed.has(key)))
throw new Error("Unknown public chat payload field");
const fields = (value, names) => {
if (View on GitHub (pinned to 01ad858492)
Solutions
- Regenerate the public payload with the current generator so publication.schema matches PUBLIC_CHAT_SCHEMA in public-eval-chat.mjs.
- Pass the projected public payload (output of the public chat projection step), not the internal replay/run payload.
- Ensure the generator sets view.sessionId="public-report", composer.state="disabled", connection.state="closed", and devtools=null.
- Sync packages/paperclip-runner so the generator and this validator use the same PUBLIC_CHAT_SCHEMA constant version.
Example fix
// before validatePublicChatPayload(internalReplayPayload); // after const publicPayload = buildPublicChatProjection(internalReplayPayload); validatePublicChatPayload(publicPayload);
Defensive patterns
Strategy: type-guard
Validate before calling
const isPublicProjection = (p) => p?.publication?.schema === PUBLIC_CHAT_SCHEMA && p?.view?.sessionId === "public-report" && p?.view?.composer?.state === "disabled" && p?.view?.connection?.state === "closed" && p?.devtools === null;
Type guard
const looksPublic = (p) => p != null && typeof p === "object" && p.publication?.schema === PUBLIC_CHAT_SCHEMA;
Try / catch
try {
validatePublicChatPayload(payload);
} catch (err) {
if (err.message.startsWith("Public attempt must contain")) {
throw new Error("Internal payload passed where public projection required; run the projection step first");
}
throw err;
} Prevention
- Always run the internal payload through the public projection step before validation
- Keep generator and validator on the same PUBLIC_CHAT_SCHEMA constant; bump both together
- Add a unit test that internal payloads fail validation and projected ones pass
- Never construct public payloads by hand; use the projector API
When it happens
Trigger: Calling validatePublicChatPayload with: a payload produced by an older generator using a different PUBLIC_CHAT_SCHEMA value; a raw internal replay payload (real sessionId, live composer/connection states, non-null devtools); a null/undefined payload; or a hand-built object missing the publication/view fields.
Common situations: Generator and viewer versions out of sync after the schema constant was bumped; accidentally passing the internal run payload instead of the public projection; tests constructing partial fixtures that skip the publication block.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Worktree seed manifest is missing source path diagnostics.
- sandbox runtime asset key is not a simple path segment: ${ke
- unsupported request schema
- Invalid GitHub launcher run ID
- Unexpected trusted viewer asset
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10).
Data as JSON: /api/errors/22bc9839fc3a469b.
Report an issue: GitHub.