Full ALPR Database System for Blue Iris!

Anyone ever figure out the solution to Error processing request: error: null value in column "id" of relation "plate_reads" violates not-null constraint
I ran two fresh install on two different systems, and still same issue
 
I've installed this on multiple machines for other users and have never seen this error. Are you using the the updated migrations.sql file?
This is a fresh install using the script. Iv googled it and others are having the same issue.

I'm also using version 6 of blueiris if it makes a difference
 
This is a fresh install using the script. Iv googled it and others are having the same issue.

I'm also using version 6 of blueiris if it makes a difference
The version of BI doesn't matter. Does your file structure look like this?

Screen Shot 2025-12-28 at 7.34.20 PM.png
 
Anyone ever figure out the solution to Error processing request: error: null value in column "id" of relation "plate_reads" violates not-null constraint
I ran two fresh install on two different systems, and still same issue
I had that issue each time I installed as well. My only solution was to use Chatgpt to troubleshoot. To my memory the error was occurring because the database was expecting a column of data in the table that didn't exist. It ended up having me do a lot of Powershell commands to correct the issue but it's been running perfectly for months now. :)
 
I had that issue each time I installed as well. My only solution was to use Chatgpt to troubleshoot. To my memory the error was occurring because the database was expecting a column of data in the table that didn't exist. It ended up having me do a lot of Powershell commands to correct the issue but it's been running perfectly for months now. :)
Let me give that a go. I was going to go that route but I saw so many people having this issue I thought someone for sure would have fixed it by now
 
Here is the fix I applied
I ran this in the console section of portainer. I was in container alpr_database-db-1

#to get into PostgresSQL

psql -U postgres

#Then I applied this fix. Just copy and paste it


-- Create a sequence for the id column
CREATE SEQUENCE IF NOT EXISTS plate_reads_id_seq;

-- Attach the sequence to plate_reads.id
ALTER TABLE plate_reads
ALTER COLUMN id SET DEFAULT nextval('plate_reads_id_seq');

-- Ensure proper ownership
ALTER SEQUENCE plate_reads_id_seq
OWNED BY plate_reads.id;

-- Sync the sequence with existing rows
SELECT setval(
'plate_reads_id_seq',
COALESCE((SELECT MAX(id) FROM plate_reads), 1),
true
);
 
Here is the fix I applied
I ran this in the console section of portainer. I was in container alpr_database-db-1

#to get into PostgresSQL

psql -U postgres

#Then I applied this fix. Just copy and paste it


-- Create a sequence for the id column
CREATE SEQUENCE IF NOT EXISTS plate_reads_id_seq;

-- Attach the sequence to plate_reads.id
ALTER TABLE plate_reads
ALTER COLUMN id SET DEFAULT nextval('plate_reads_id_seq');

-- Ensure proper ownership
ALTER SEQUENCE plate_reads_id_seq
OWNED BY plate_reads.id;

-- Sync the sequence with existing rows
SELECT setval(
'plate_reads_id_seq',
COALESCE((SELECT MAX(id) FROM plate_reads), 1),
true
);

OMG!!! This finally fixed my setup! Thank you.
 
Your welcome I was also getting this error and here is the fix for it "plate_notifications_plate_number_key" for table "plate_notifications" does not exist



-- Add UNIQUE constraint for plate_number
ALTER TABLE plate_notifications
ADD CONSTRAINT plate_notifications_plate_number_key
UNIQUE (plate_number);

-- Create auto-increment sequence for id if it doesn't exist
CREATE SEQUENCE IF NOT EXISTS plate_notifications_id_seq;

ALTER TABLE plate_notifications
ALTER COLUMN id SET DEFAULT nextval('plate_notifications_id_seq');

ALTER SEQUENCE plate_notifications_id_seq
OWNED BY plate_notifications.id;

-- Sync sequence with existing data (if any)
SELECT setval('plate_notifications_id_seq', COALESCE((SELECT MAX(id) FROM plate_notifications), 1), true);
 
Ugh. After getting a useful plate capture on January 8, I updated my BI to version 6, and now my ALPR + Database isn't working any more.

It's been so long since I originally set it up that I don't remember all the steps and "gotchas" any more.

I don't even know whether the problem is on the BI/AI side or on the database side, but probably the former, because the ALPR Database web page is running; it just shows zero entries in the db since 1/16/26, which the day I updated BI6.

I'm not averse to either using the old CPAI or the new BIAI, as long as I can get it working :D.

Didn't someone write a step-by-step troubleshooting guide on how to get this all working together? Does anything significant change with BI6?
 
Ugh. After getting a useful plate capture on January 8, I updated my BI to version 6, and now my ALPR + Database isn't working any more.

It's been so long since I originally set it up that I don't remember all the steps and "gotchas" any more.

I don't even know whether the problem is on the BI/AI side or on the database side, but probably the former, because the ALPR Database web page is running; it just shows zero entries in the db since 1/16/26, which the day I updated BI6.

I'm not averse to either using the old CPAI or the new BIAI, as long as I can get it working :D.

Didn't someone write a step-by-step troubleshooting guide on how to get this all working together? Does anything significant change with
Look at your logs. Its probably the database issue that I posted fixes on just a few posts before this one.
 
Here is the fix I applied
I ran this in the console section of portainer. I was in container alpr_database-db-1

#to get into PostgresSQL

psql -U postgres
Hmm. I'm running Docker Desktop on Win11 Pro, on the same machine that BI is running on, and when I try this from Open in Terminal and attempt that first command, I'm getting "psql: not found"

1769804125302.png
 
Look at your logs. Its probably the database issue that I posted fixes on just a few posts before this one.
I think you're asking about my logs from the ALPR Database web server, correct?

1769804466704.png


I'm getting a repeated series of these:

Code:
[ERROR]
Error processing request: SyntaxError: Unexpected token ',', ...""ai_dump":, "Image":"... is not valid JSON
1/30/2026, 11:04:39 AM
[INFO]
POST /api/plate-reads
1/30/2026, 11:04:57 AM
[ERROR]
Error processing request: SyntaxError: Unexpected token ',', ...""ai_dump":, "Image":"... is not valid JSON
1/30/2026, 11:04:57 AM
[INFO]
POST /api/plate-reads
1/30/2026, 11:04:58 AM
[ERROR]
Error processing request: SyntaxError: Unexpected token ',', ...""ai_dump":, "Image":"... is not valid JSON
1/30/2026, 11:04:58 AM
[INFO]
POST /api/plate-reads

My On Alert was copied/pasted directly from the GitHub page:

Code:
{ "ai_dump":&JSON, "Image":"&ALERT_JPEG", "camera":"&CAM", "ALERT_PATH": "&ALERT_PATH", "ALERT_CLIP": "&ALERT_CLIP", "timestamp":"&ALERT_TIME" }
and my system AI is set up as:

1769804405108.png


I'm trying to remember whether we're supposed to check this box or not.
 
UI3 version 315, Blue Iris version: 6.0.1.30
The reason I asked is Ken made a change to what the JSON command is looking for in a couple of versions, but has since reverted back to what it originally was. I can't remember exactly which versions were affected, but I know 6.0.1.30 is working. To check if this is affecting your system you need to open an ALPR alert in BI's AI Inspector and look at the results of the dat file. Towards the top It should read "api":"alpr",. If it says anything else then the ALPR database app cannot read the data.

Screen Shot 2026-01-30 at 1.26.27 PM.png
 
  • Like
Reactions: TheWaterbug