Bug 490524 - BQM custom scripts stopped working after upgrading OS
Summary: BQM custom scripts stopped working after upgrading OS
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Bqm-Script (other bugs)
Version First Reported In: 8.3.0
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-19 20:37 UTC by _
Modified: 2025-12-12 19:44 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 8.9.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ 2024-07-19 20:37:39 UTC
After upgrading to Xubuntu 24.04 custom scripts stopped working. I used the exact same 8.3.0 appimage than previously, and 8.4.0 doesn't fix the problem.

Example script:

cp $INPUT $OUTPUT
convert -strip $INPUT $OUTPUT

Errors in history output:

"Failed to process item..."
"User Script: Error code returned 1"

This applies to all commands, tested that convert command itself works. I've tried to replace workflows as much as possible with built in base tools, but eg. "Remove Metadate" asks only Exif, Iptc, Xmp, but seemed to leave makernote (re-tested and for some reason now doesn't do anything).
Comment 1 Maik Qualmann 2024-07-19 21:13:39 UTC
Your script works here without any problems.
We need the log in the terminal with debugging activated in the digiKam setup.

Maik
Comment 2 _ 2024-07-19 22:48:22 UTC
Is this enough?

Digikam::BatchTool::CustomTool  :: wurl=  QUrl("file:///media/photo")
Digikam::BatchTool::setOutputUrlFromInputUrl: path:  "/media/photo/BatchTool-dhVhqB-ca42a842.digikamtempfile.JPG"
Digikam::BatchTool::apply: Tool:        "User Shell Script"
Digikam::BatchTool::apply: Input url:   QUrl("file:///media/photo/20240718T185159_v1.JPG")
Digikam::BatchTool::apply: Output url:  QUrl("file:///media/photo/BatchTool-dhVhqB-ca42a842.digikamtempfile.JPG")
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
unknown: Script stdout ""
unknown: Script stderr "convert-im6.q16: no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/581.\nconvert-im6.q16: no images defined `/media/photo/BatchTool-dhVhqB-ca42a842.digikamtempfile.JPG' @ error/convert.c/ConvertImageCommand/3234.\n"
unknown: Script exit code: 1

Checked convert and problem doesn't seem to be there?

$ convert -list configure | grep DELEGATES
DELEGATES      bzlib djvu fftw fontconfig freetype heic jbig jng jpeg lcms lqr lzma openexr openjp2 pango png ps raw tiff webp wmf x xml zlib zstd
DELEGATES      bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf x xml zlib
Comment 3 Maik Qualmann 2024-07-20 04:20:02 UTC
The copy command is not necessary because convert creates an output file itself. But that is probably not the cause. But it could be the order of the options. Try the following:

convert $INPUT -strip $OUTPUT

Maik
Comment 4 _ 2024-07-20 08:02:44 UTC
Either doesn't fix the problem. If I leave copy line out I will get many more error messages:

Failed to process item...
User Script: Error code returned 1.
Failed to process item....
Failed to create file...

log output

Digikam::ActionThreadBase::setMaximumNumberOfThreads: Using  1  CPU core to run threads
Digikam::ActionThreadBase::run: Action Thread run 1 new jobs
Digikam::ActionTask::run: Tool : index=  1  :: name=  "UserScript"  :: group=  Digikam::BatchTool::CustomTool  :: wurl=  QUrl("file:///media/photo")
Digikam::BatchTool::setOutputUrlFromInputUrl: path:  "/media/photo/BatchTool-sTXUvZ-dbb5dc9e.digikamtempfile.JPG"
Digikam::BatchTool::apply: Tool:        "User Shell Script"
Digikam::BatchTool::apply: Input url:   QUrl("file:///media/photo/20240718T185159_v2.JPG")
Digikam::BatchTool::apply: Output url:  QUrl("file:///media/photo/BatchTool-sTXUvZ-dbb5dc9e.digikamtempfile.JPG")
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
unknown: Script stdout ""
unknown: Script stderr "convert-im6.q16: no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/581.\nconvert-im6.q16: no images defined `/media/photo/BatchTool-sTXUvZ-dbb5dc9e.digikamtempfile.JPG' @ error/convert.c/ConvertImageCommand/3234.\n"
unknown: Script exit code: 1
Digikam::ActionThreadBase::slotJobFinished: One job is done  Digikam::ActionTask(0x5d9bc5c26980)  time: 70
Digikam::ActionThread::slotThreadFinished: List of Pending Jobs is empty
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DNotificationWrapper: Event is dispatched to desktop notifier through DBUS
Comment 5 _ 2024-07-20 08:08:40 UTC
... if I keep the copy line process virtually finishes as new file is created like expected (but without needed changes), if i leave it out no new file appears. I'm unsure how all this combines with what is selected in "Queue Settings > Behavior"... I have there "Store as a different name".
Comment 6 Maik Qualmann 2024-07-21 15:22:23 UTC
I installed Xubuntu 24.04 + ImageMagick in a VM and downloaded the digiKam-8.4.0 AppImage. No problem with the BQM user script and the convert command to remove all metadata.
You will have to look for the problem yourself on your computer. You may have remnants of an old ImageMagick installation or something else.

Maik
Comment 7 _ 2024-07-22 16:41:59 UTC
Thanks for your help. I'll see through my profile which I saved from previous installation. Possibly I could create another fresh profile for testing.
Comment 8 _ 2024-07-22 16:57:16 UTC
Creating fresh profile didn't help. Otherwise this was new installation.
Comment 9 _ 2024-08-25 17:34:52 UTC
This is not directly *convert* issue as running *ffmpeg* doesn't work either.
Comment 10 caulier.gilles 2025-04-04 01:32:57 UTC
Hi,

The new AppImage bundle 8.7.0 pre-release for Linux based on Qt 6.8.3 is
online at usual place :

https://files.kde.org/digikam/

Let's me know if the problem remain.

Best regards

Gilles Caulier
Comment 11 _ 2025-11-29 08:17:21 UTC
8.8.0 appimage now gives

ffmpeg -i $INPUT -vn -c:a copy $INPUT.m4a

10:12:52 :: Item "file.ext" from queue "#1": Processing...
10:12:52 :: Item "file.ext" from queue "#1": Failed to process item...
10:12:52 :: Item "file.ext" from queue "#1": Failed to process item...
10:12:52 :: Item "file.ext" from queue "#1": Failed to create file...
10:12:52 :: Item "file.ext" from queue "#1": User Script: Error code returned 234.
Comment 12 _ 2025-11-29 09:19:52 UTC
Ignore previous. Last error code possibly came just because the MOV video file type didn't contain M4A. 

Testing with MP4 didn't give error core, but just:

Processing...
Failed to process item....
Failed to create file...
Comment 13 Maik Qualmann 2025-11-29 09:58:14 UTC
Why from $INPUT to $INPUT? That can't possibly work. If anything, please encode to $OUTPUT. A new file must always be created at $OUTPUT. And you can't append an .m4a string to an escaped path string; there's a renaming function in BQM for that.

Maik
Comment 14 _ 2025-12-08 08:43:51 UTC
Documentation is just too obscure to me. These scripts were working fine before. If you have orthodox script I can try.
Comment 15 _ 2025-12-08 08:45:56 UTC
Same error for 

ffmpeg -i $INPUT -vn -c:a copy $OUTPUT.m4a

Item "file.MP4" from queue "#1": Processing...
Item "file.MP4" from queue "#1": Failed to process item...
Item "file.MP4" from queue "#1": Failed to create file...
Comment 16 Maik Qualmann 2025-12-08 08:57:56 UTC
You cannot append an extension to "$OUTPUT" because the file path is internally encapsulated in quotation marks to handle spaces in file paths.

Maik
Comment 17 _ 2025-12-08 09:30:58 UTC
ffmpeg -i $INPUT -vn -c:a copy $OUTPUT

keeps processing for a minute.

Item "file.MP4" from queue "#1": Processing...
Item "file.MP4" from queue "#1": Failed to process item...
Item "file.MP4" from queue "#1": Failed to process item...
Item "file.MP4" from queue "#1": Failed to create file...
Item "file.MP4" from queue "#1": User Script: No error.

As I said before, problems started when I upgraded linux system - clean install over previous. Running similar commands directly in terminal works as before. All BQM scripts I use were functioning correctly before upgrade. I tried them in many different forms before finding working ones by trial and error.
Comment 18 Maik Qualmann 2025-12-08 11:37:04 UTC
The reason is that current ffmpeg versions stop/ask if the output file already exists (here is a 0-byte temp file on $OUTPUT). Therefore, you need to add the "-y" parameter.

ffmpeg -i $INPUT -y -vn -c:a copy $OUTPUT.m4a

You can rename the file in the Rename tab using these two possible strings:

[file].[ext].m4a

or

[file].[ext]{replace:".mp3",".m4a",i}

Maik
Comment 19 Maik Qualmann 2025-12-08 11:39:04 UTC
In my example, of course, without .m4a after $OUTPUT.

ffmpeg -i $INPUT -y -vn -c:a copy $OUTPUT

Maik
Comment 20 _ 2025-12-09 19:17:00 UTC
Thanks! That really worked for ffmpeg. 

However the same problem appeared same time with convert. 

In this case convert creates a new image but no processing:

cp $INPUT $OUTPUT
convert -geometry 1000x1000 -sharpen 2 -quality 85 -strip $INPUT $OUTPUT

Item "filename_v1.jpg" from queue "#1": Processing...
Item "filename_v1.jpg" from queue "#1": Failed to process item...
Item "filename_v1.jpg" from queue "#1": User Script: Error code returned 1.
Item "filename_v1.jpg" from queue "#1": Item processed successfully (renamed to 20251209T070321_v2.jpg)
Comment 21 Maik Qualmann 2025-12-09 19:32:37 UTC
The new image comes from your copy command, which isn't needed here since "convert" itself creates a new file.

The command works without errors here. However, note that "convert" is deprecated in newer versions of ImageMagick, and the new command is "magick".

Enable internal debugging in digiKam Setup (restart digiKam) and check in the terminal what error "convert" reports.

Maik
Comment 22 _ 2025-12-12 05:18:41 UTC
Log when run without cp line:

unknown: failed to create compose table
Digikam::ActionThreadBase::setMaximumNumberOfThreads: Threads Pool "QueueMngrThread" will use 1 threads
Digikam::ActionThreadBase::run: Action Thread run 1 new jobs
Digikam::ActionTask::run: Tool : index=  1  :: name=  "UserScript"  :: group=  Digikam::BatchTool::CustomTool  :: wurl=  QUrl("file:///PATH/TO/FILE")
Digikam::BatchTool::setOutputUrlFromInputUrl: path:  "/PATH/TO/FILE/BatchTool-XNxRxS-55e9ab53.digikamtempfile.JPG"
Digikam::BatchTool::apply: Tool:        "User Shell Script"
Digikam::BatchTool::apply: Input url:   QUrl("file:///PATH/TO/FILE/FILENAME.JPG")
Digikam::BatchTool::apply: Output url:  QUrl("file:///PATH/TO/FILE/BatchTool-XNxRxS-55e9ab53.digikamtempfile.JPG")
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
unknown: Script stdout ""
unknown: Script stderr "convert-im6.q16: no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/581.\nconvert-im6.q16: no images defined `/PATH/TO/FILE/BatchTool-XNxRxS-55e9ab53.digikamtempfile.JPG' @ error/convert.c/ConvertImageCommand/3234.\n"
unknown: Script exit code: 1
Digikam::ActionThreadBase::slotJobFinished: One job is done Digikam::ActionTask(0x6202018b3240) time: 110
Digikam::ActionThread::slotThreadFinished: List of Pending Jobs is empty
Digikam::DNotificationWrapper: Event is dispatched using KDE desktop notifier
Comment 23 Maik Qualmann 2025-12-12 06:52:49 UTC
The ImageMagick convert program cannot find its decoder for JPEG files. This may be related to the AppImage, as we need to redirect some environment variables to the digiKam AppImage container.

Maik
Comment 25 Maik Qualmann 2025-12-12 07:07:08 UTC
Git commit 3ae0249c43fc96cab96794928aed4f5e08cd156f by Maik Qualmann.
Committed on 12/12/2025 at 07:06.
Pushed by mqualmann into branch 'master'.

restore ImageMagick environment variables

M  +20   -0    core/app/utils/digikam_globals_bundles.cpp
M  +3    -0    project/bundles/appimage/data/AppRun

https://invent.kde.org/graphics/digikam/-/commit/3ae0249c43fc96cab96794928aed4f5e08cd156f
Comment 26 Maik Qualmann 2025-12-12 12:16:38 UTC
A new pre-release digiKam-8.9.0 AppImage with the change is available, please test it:

https://files.kde.org/digikam/

Maik
Comment 27 _ 2025-12-12 19:44:50 UTC
Works!