Shell_command "duplicated mapping key" but no duplicate?

hellom,

i added some shell_command in my configuration.yaml, but got an duplicated mapping key error? but there is no duplicate?

it occours at fourth line …token and url are definitey different…?
what make me more confuse: when commenting the lines, the error stays?
is there a limit in naming shell commands or what is the problem?

thanx in advance
br
Frank

when commenting the 3rd line too, error is gone?

when uncommenting any of the other lines, but 2 uncommented, then it ok without error, but at the moment i uncommen any third line, error comesback?
is thee a limit of 2?

line are very long, with token und url?

ok problem seems something older… the first 7 lines are existing for 2-3 years?

Surround your commands at lines 3 and 4 with quotes.

Also please don’t share pictures of text. Paste the config into the post and format it correctly using the </> button (sometimes under the cog icon on small displays) or by doing this: https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

thanx tom,

sry i had started posting first picture instead of code as the “indicator —^” was not placed in same position when posting as code, so i did all following pictures ´same way… later i realized the correct column is shown in first line :person_facepalming:

thanx your mentioned quotation marks solved the newly added lines :+1:, but the first 2 existing shell commands are showing errors anyway? i see this backups had stopped working with latest HASSIO update from 2025.09…=>2026.1.0; seems the quotation marks surround the date is a problem since then?
also the double slash are irritating me, is that correct? but it did worked since last update?

bad indentation of a mapping entry (3:77)

#shell_command.yaml
# Backup logs and append a version number if one already exists.
backup_logs: "cp /config/home-assistant.log /config/log_backup//log-`date +"%Y%m%d%H%M"`.log"
backup_logs1: "cp /config/home-assistant.log.1 /config/log_backup/log-`date +"%Y%m%d%H%M"`.log.1"

You need to use single quotes if you already have double quotes in your config. Otherwise you end up with a pair of quotes only enclosing this:

backup_logs: "cp /config/home-assistant.log /config/log_backup//log-`date +"

Also you seem to have backticks in your command.

thanx tom,
weird that it worked for that longe time?

corrected and working code…

# Backup logs and append a version number if one already exists.
backup_logs: "cp /config/home-assistant.log /config/log_backup//log-'date +'%Y%m%d%H%M''.log"
backup_logs1: "cp /config/home-assistant.log.1 /config/log_backup/log-'date +'%Y%m%d%H%M''.log.1"

You still have issues.

Count along the single quotes and see where they pair up.

'date +' and ''

hi @tom_l ,

would you pls so kind and correct at least one line? i don´t undestand the usage of the single quotes…

had tried this, but its three single quotes, what does not work…

backup_logs: "cp /config/home-assistant.log /config/log_backup//log-'date +'%Y%m%d%H%M'.log"

what would be correct? this…

backup_logs: "cp /config/home-assistant.log /config/log_backup//log-'date' +'%Y%m%d%H%M'.log"

or this?

backup_logs: "cp /config/home-assistant.log /config/log_backup//log-'date +%Y%m%d%H%M'.log"

thanx in advance
br
Frank