ruvnet/ruflo · error · Error
Failed to create share link
Error message
Failed to create share link
What it means
Thrown by createShareLink after POST {base}/conversation/{id}/share returns a non-2xx response. The error prefers the response body text (if any) and falls back to the generic 'Failed to create share link'. It is a network/backend failure signal from the share endpoint, not a client-side validation error.
Source
Thrown at ruflo/src/ruvocal/src/lib/createShareLink.ts:22
// Returns a public share URL for a conversation id.
// If `id` is already a 7-char share id, no network call is made.
export async function createShareLink(id: string): Promise<string> {
const prefix =
page.data.publicConfig.PUBLIC_SHARE_PREFIX ||
`${page.data.publicConfig.PUBLIC_ORIGIN || page.url.origin}${base}`;
if (id.length === 7) {
return `${prefix}/r/${id}`;
}
const res = await fetch(`${base}/conversation/${id}/share`, {
method: "POST",
headers: { "Content-Type": "application/json" },
});
if (!res.ok) {
const text = await res.text().catch(() => "");
throw new Error(text || "Failed to create share link");
}
const { shareId } = await res.json();
return `${prefix}/r/${shareId}`;
}
View on GitHub (pinned to 6b01dc5a68)
Solutions
- Inspect the actual response status/body — the thrown message often contains the backend's error text; log res.status before throwing if you control the call site.
- Confirm the conversation id exists and belongs to the current user before sharing.
- Ensure the request carries the auth token/cookie the share route requires.
- Verify the backend share endpoint is up and reachable (check {base} and network).
Example fix
// before
const link = await createShareLink(id); // opaque failure
// after
try {
const link = await createShareLink(id);
} catch (e) {
console.error('share failed for', id, e.message);
// surface backend text, retry once, or degrade gracefully
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!id || typeof id !== 'string') throw new Error('conversation id required');
// optionally HEAD the conversation to confirm it exists & belongs to the user before sharing Type guard
function isValidConversationId(id: string): boolean { return typeof id === 'string' && id.length > 0; } Try / catch
try { return await createShareLink(id); } catch (e) { console.error('share failed', id, (e as Error).message); return null; } Prevention
- Confirm the conversation exists and belongs to the user before sharing.
- Ensure the auth token/cookie is on the request.
- Log res.status at the call site to disambiguate backend failures.
When it happens
Trigger: The share POST responds with 4xx/5xx: conversation id not found (404), user not authorized (401/403), backend down (500/502), or rate limited (429). The id.length === 7 short-circuit path above (which builds a local /r/{id} URL) is skipped, so only the longer ids reach the network call.
Common situations: Sharing a conversation that was deleted or never persisted; calling createShareLink without a valid auth token/cookie; the share route handler threw; dev environment without a running backend so the POST 502s; CORS or network error making res.ok false.
Related errors
- SSRF guard: private/loopback host rejected — ${host}
- Unauthorized
- Failed to fetch base servers: ${response.statusText}
- Failed to fetch ${url}: ${response.status} ${response.status
- SSRF guard: private/loopback host rejected — ${host}
AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12).
Data as JSON: /api/errors/8fb8055856bc31c7.
Report an issue: GitHub.