actualbudget/actual · error
Unknown Detail Code: ${line[0]}
Error message
Unknown Detail Code: ${line[0]} What it means
While parsing QIF transaction lines, each line's first character is a detail code (D, T, P, N, etc.). When the parser encounters a leading character it has no handler for, it throws this error naming the unknown code. This guards against silently dropping transaction data from a malformed or extended QIF dialect.
Source
Thrown at packages/loot-core/src/server/transactions/import/qif2json.ts:102
division.category = sArray[0];
if (sArray[1] !== undefined) {
division.subcategory = sArray[1];
}
break;
case 'E':
division.description = line.substring(1);
break;
case '$':
division.amount = parseFloat(line.substring(1));
if (!(transaction.division instanceof Array)) {
transaction.division = [];
}
transaction.division.push(division);
division = {};
break;
default:
throw new Error('Unknown Detail Code: ' + line[0]);
}
}
if (Object.keys(transaction).length) {
transactions.push(transaction);
}
return data;
}
View on GitHub (pinned to d4334cb6e6)
Solutions
- Identify the offending line/code from the error and check whether your bank's exporter emits nonstandard QIF extension codes.
- Sanitize the file: remove or remap unsupported line codes to supported ones before parsing.
- Re-export the QIF with a simpler/standard profile from the source application.
- As a last resort, pre-process the file to strip unknown single-letter-prefixed lines, accepting possible data loss.
Example fix
// before
const data = qif2json.parse(rawQif);
// after
const sanitized = rawQif
.split(/\r?\n/)
.filter(l => /^[A-Za-z]/.test(l) === false || 'DMTNPQCALUEM^'.includes(l[0]))
.join('\n');
const data = qif2json.parse(sanitized); Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-scan for unsupported detail codes
const known = new Set(['D','T','P','N','Q','C','A','L','M','E','S','$','^','U','!']);
const unknown = content.split(/\r?\n/).filter(l => l && !known.has(l[0]) && l[0] !== '!');
if (unknown.length) console.warn('Unknown QIF codes:', unknown.map(l => l[0])); Try / catch
try {
const data = parseQIF(file);
} catch (e) {
if (e.message.startsWith('Unknown Detail Code:')) {
const code = e.message.split(': ')[1];
showError(`QIF contains unsupported detail code '${code}' — re-export in standard QIF`);
} else { throw e; }
} Prevention
- Scan the file for single-letter-prefixed lines outside the known code set before importing
- Prefer the standard/simple QIF export profile from the source application
- Log the offending line (included in the message context) to identify vendor extensions
When it happens
Trigger: A QIF file containing line codes outside the supported set — e.g. vendor-specific extension codes like 'L' in unexpected contexts, 'A' address lines handled inconsistently, or a corrupted line where a code character was lost/mangled.
Common situations: Exports from less common accounting software using nonstandard QIF extensions; files produced by a broken export tool emitting truncated lines; copy-paste artifacts introducing stray characters.
Related errors
- File does not appear to be a valid qif file: ${line}
- Error importing budget: ${result.error}
- Error importing budget: no budget was loaded
- zipMeta ? getUnsafeZipError(zipMeta) : error
- An error occurred while parsing the template
AI-assisted analysis of actualbudget/actual@d4334cb6e6 (2026-08-29).
Data as JSON: /api/errors/411586471e74a1d9.
Report an issue: GitHub.