danielmiessler/Fabric · error · Error
data.error
Error message
data.error
What it means
After a 2xx response, transcriptService checks the parsed body and throws data.error when the server embedded an application-level error in an otherwise successful HTTP reply. This is the envelope-error pattern: transport succeeded, operation failed.
Source
Thrown at web/src/lib/services/transcriptService.ts:53
})
});
console.log('2. Server response:', {
status: response.status,
ok: response.ok,
type: response.type,
originalLanguage,
currentLanguage: get(languageStore)
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(errorData.error || `HTTP error! status: ${response.status}`);
}
const data = await response.json();
if (data.error) {
throw new Error(data.error);
}
// Decode HTML entities in transcript
data.transcript = decodeHtmlEntities(data.transcript);
// Ensure language is preserved
if (get(languageStore) !== originalLanguage) {
console.log('3a. Restoring original language:', originalLanguage);
languageStore.set(originalLanguage);
}
console.log('3b. Processed transcript:', {
status: response.status,
transcriptLength: data.transcript.length,
firstChars: data.transcript.substring(0, 100),
hasError: !!data.error,
videoId: data.title,
originalLanguage,View on GitHub (pinned to 338b89cfe9)
Solutions
- Read the exact data.error string to identify the operation failure
- If captions are missing, pick another language or skip transcript features for that video
- Prefer fixing the backend to use proper status codes, keeping client checks as defense
Defensive patterns
Strategy: type-guard
Type guard
function hasEnvelopeError(data: unknown): data is { error: string } {
return typeof data === 'object' && data !== null && typeof (data as any).error === 'string';
} Try / catch
try { transcript = await transcriptService.get(videoUrl); }
catch (e) {
if (e instanceof Error && /no captions|unavailable/i.test(e.message)) return null; // soft-fail
throw e;
} Prevention
- Guard the parsed body with hasEnvelopeError before using transcript fields
- Push the backend toward proper status codes to collapse the two error tiers
When it happens
Trigger: Transcript endpoint returning 200 with { error: 'no captions for language X' } or { error: 'video unavailable' } — operation-level failures the server chose not to signal via status code.
Common situations: Backend convention of always-200-with-error-field; partial failures like translation succeeding but transcript retrieval failing; version drift where the frontend expects transcript data but the server emitted an error object.
Related errors
- response.error
- errorData.error || `HTTP error! status: ${response.status}`
- HTTP error! status: ${response.status}
- Invalid response format: missing vendors data
- HTTP_ERROR
AI-assisted analysis of danielmiessler/Fabric@338b89cfe9 (2026-08-15).
Data as JSON: /api/errors/6d038ddd36d889ab.
Report an issue: GitHub.