ALPR-Database icon indicating copy to clipboard operation
ALPR-Database copied to clipboard

getting error in alpr

Open brandon-souder opened this issue 4 months ago • 7 comments

bI is getting no stream 500

in docker logs getting Error processing request: error: null value in column "id" of relation "plate_reads" violates not-null constraint

at async NextNodeServer.renderToResponseImpl (/app/node_modules/next/dist/server/base-server.js:2278:32) {

length: 486,

severity: 'ERROR',

code: '23502',

detail: 'Failing row contains (null, REX 1186, null, images/2025/09/27/REX 1186_1758990133561_cf370237.jpg, thumbnails/2025/09/27/REX 1186_1758990133561_cf370237_thumb.jpg, 2025-09-27 12:22:06.83-04, 2025-09-27 12:22:13.611268-04, PTZ, ui3.htm?rec=283233966790894-44642&cam=PTZ, null, {568,749,724,879}, null, 0.97, null, f).',

hint: undefined,

position: undefined,

internalPosition: undefined,

internalQuery: undefined,

where: undefined,

schema: 'public',

table: 'plate_reads',

column: 'id',

dataType: undefined,

constraint: undefined,

file: 'execMain.c',

line: '1941',

routine: 'ExecConstraints'

}

POST /api/plate-reads

Received plate read data: {

ai_dump: [

{ api: 'objects', found: [Object] },

{ api: 'alpr', found: [Object] }

],

brandon-souder avatar Sep 27 '25 16:09 brandon-souder

Likely happening because you are detecting both objects and plates. So the AI_dump also contains an object detection that it tries to handle like a plate.

I thought I fixed the parsing to handle this in the last update so it ignores any sent objects. Please verify that you are on the latest version.

I'll take another look at it and get it fixed if it's still happening in the latest release.

algertc avatar Sep 27 '25 17:09 algertc

Just installed today so assuming yes on latest version

brandon-souder avatar Sep 27 '25 19:09 brandon-souder

Gotcha. I'll investigate. Thanks for reporting.

In the meantime, switching to use the plate_number key with &PLATE should work without issue.

Additional info on that option is available on the alprdatabase.org docs site and in the readme.

algertc avatar Sep 27 '25 21:09 algertc

Sorry if this is a noob question didn’t see the answer in docs

Do I use plate_number&PLATE in the data string in BI

On Sep 27, 2025, at 5:09 PM, Charlie Algert @.***> wrote:

plate_number key with &PLATE

brandon-souder avatar Sep 27 '25 23:09 brandon-souder

Yes. It should be like:

{ "plate_number":&PLATE, rest of payload}.

I recommend making sure that you have the clip and path variables in there too (see below). That will let you easily open alerts in BI from the ALPR database.

Should probably be like this, if I'm not mistaken:

{ "plate_number":&PLATE, "Image":"&ALERT_JPEG", "camera":"&CAM", "ALERT_PATH": "&ALERT_PATH", "ALERT_CLIP": "&ALERT_CLIP", "timestamp":"&ALERT_TIME" }

algertc avatar Sep 28 '25 04:09 algertc

used that exact string and still getting the errors

BI says Web: no stream 400

brandon-souder avatar Oct 03 '25 22:10 brandon-souder

got a little further go the plate to show up in the logs but getting new errors now

          INSERT INTO plate_reads (

            plate_number, 

            image_data, 

            image_path, 

            thumbnail_path,

            timestamp, 

            camera_name,

            bi_path,

            confidence,

            crop_coordinates,

            ocr_annotation,

            plate_annotation

          )

          SELECT $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11

          WHERE NOT EXISTS (

            SELECT 1 FROM plate_reads 

            WHERE plate_number = $1 AND timestamp = $5

          )

          RETURNING id

        )

        SELECT id FROM new_read

app

Error processing request: error: null value in column "id" of relation "plate_reads" violates not-null constraint

at <unknown> (/app/node_modules/pg/lib/client.js:535:17)

at async d (/app/.next/server/app/api/plate-reads/route.js:1:6737)

at async te.do (/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:18:17826)

at async te.handle (/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:18:22492)

at async doRender (/app/node_modules/next/dist/server/base-server.js:1455:42)

at async responseGenerator (/app/node_modules/next/dist/server/base-server.js:1814:28)

at async NextNodeServer.renderToResponseWithComponentsImpl (/app/node_modules/next/dist/server/base-server.js:1824:28)

at async NextNodeServer.renderPageComponent (/app/node_modules/next/dist/server/base-server.js:2240:24)

at async NextNodeServer.renderToResponseImpl (/app/node_modules/next/dist/server/base-server.js:2278:32) {

length: 329,

severity: 'ERROR',

code: '23502',

detail: 'Failing row contains (null, ABC 1234, null, null, null, 2025-10-31 15:54:55.084-04, 2025-10-31 15:55:09.198186-04, PTZ, null, null, null, null, null, null, f).',

hint: undefined,

position: undefined,

internalPosition: undefined,

internalQuery: undefined,

where: undefined,

schema: 'public',

table: 'plate_reads',

column: 'id',

dataType: undefined,

constraint: undefined,

file: 'execMain.c',

line: '1941',

routine: 'ExecConstraints'

}

brandon-souder avatar Oct 31 '25 19:10 brandon-souder