---
id: change/bcapps/10143
type: change
title: "#10143 Handle non-invoice or currupt PDF extraction"
summary: E-document extraction now detects non-invoice or corrupt PDFs that return empty data and stops with a clear error, preventing creation of empty drafts and unnecessary vendor searches.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit edocument json helper
  - codeunit edoc prepare purch. draft
  - codeunit e-document adi handler
  - codeunit e-document mllm handler
system: integration
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:08:31.905Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 6f6a3438918a7b1b3ed03f55ec7663d50e9750f6
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/10143
    title: "microsoft/BCApps#10143: Handle non-invoice or currupt PDF extraction"
    date: "2026-08-17"
    commit: 6f6a3438918a7b1b3ed03f55ec7663d50e9750f6
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/codeunit/6121
    - object/codeunit/6406
    - object/codeunit/6174
    - object/codeunit/6231
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 10143
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/10143
kind: pr
base_branch: main
major: "30"
merged_at: "2026-08-17T16:40:08Z"
author: Explorer986
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - "Team: Integrations"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 5
  additions: 207
  deletions: 12
  al: 4
apps:
  - EDocument
objects_touched:
  - key: codeunit/6121
    page: codeunit/6121
    type: codeunit
    id: 6121
    name: EDocument Json Helper
    app: EDocument
    status: modified
  - key: codeunit/6406
    page: codeunit/6406
    type: codeunit
    id: 6406
    name: EDoc Prepare Purch. Draft
    app: EDocument
    status: modified
  - key: codeunit/6174
    page: codeunit/6174
    type: codeunit
    id: 6174
    name: E-Document ADI Handler
    app: EDocument
    status: modified
  - key: codeunit/6231
    page: codeunit/6231
    type: codeunit
    id: 6231
    name: E-Document MLLM Handler
    app: EDocument
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 634170
systems:
  - integration
quote: null
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #10143 Handle non-invoice or currupt PDF extraction

> E-document extraction now detects non-invoice or corrupt PDFs that return empty data and stops with a clear error, preventing creation of empty drafts and unnecessary vendor searches.

[Pull request](https://github.com/microsoft/BCApps/pull/10143) · merged into `main` (BC30) on 2026-08-17 by Explorer986 · 5 files (+207 -12), 4 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Detects ADI responses that contain only empty values, such as from non-invoice, blank or corrupt PDFs
- Stops the structure step with a clear error instead of creating an empty draft
- No draft is saved and no vendor search runs after a failed extraction
- Valid header and line values are still kept and processed as before
- Tests added for detecting empty extraction responses
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 6121 "EDocument Json Helper"](../../objects/codeunit/6121.md), EDocument: modified
- [Codeunit 6406 "EDoc Prepare Purch. Draft"](../../objects/codeunit/6406.md), EDocument: modified
- [Codeunit 6174 "E-Document ADI Handler"](../../objects/codeunit/6174.md), EDocument: modified
- [Codeunit 6231 "E-Document MLLM Handler"](../../objects/codeunit/6231.md), EDocument: modified

## Context

- Work items: AB#634170
- Labels: AL: Apps (W1), Team: Integrations
- Systems: integration

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
