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

  1. Identify the offending line/code from the error and check whether your bank's exporter emits nonstandard QIF extension codes.
  2. Sanitize the file: remove or remap unsupported line codes to supported ones before parsing.
  3. Re-export the QIF with a simpler/standard profile from the source application.
  4. 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

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


AI-assisted analysis of actualbudget/actual@d4334cb6e6 (2026-08-29). Data as JSON: /api/errors/411586471e74a1d9. Report an issue: GitHub.