sops icon indicating copy to clipboard operation
sops copied to clipboard

Error unmarshalling input json: invalid character 'ÿ' looking for beginning of value age Windows

Open elvarondelacerveza opened this issue 2 years ago • 3 comments

After i try to run sops with binary windows with following command sops\sops-v3.7.3.exe --decrypt --age agekey path/file.json i am getting

Error unmarshalling input json: invalid character 'ÿ' looking for beginning of value age

Testing in Mac and this is working but for windows binary is not .

elvarondelacerveza avatar Mar 10 '23 17:03 elvarondelacerveza

Hi! I had the same problem with PowerShell. I just switched to CMD (Command prompt) and everything is fine now.

ghost avatar Mar 14 '23 08:03 ghost

This is caused by File Encoding a BOM add the start of the file. This might happens if you use the ">" to redirect stdout to a file in powershell. To solve this I used "| Out-File -Encoding ascii -FilePath " instead that solved the problem for me. In additon it might be a good idea to avoid this on age-keygen as well. This could be done be using -o on age-keygen.

sops do have an --output option as well, but I didn't get it to work. Maybe you can give it atry as well.

hurzelpurzel avatar Mar 31 '23 19:03 hurzelpurzel

@hurzelpurzel

sops do have an --output option as well, but I didn't get it to work. Maybe you can give it atry as well.

Please note that sops's command line parser requires all parameters to come before positional arguments. So sops\sops-v3.7.3.exe --decrypt --age agekey path/file.json --output path/file.out won't work (it will think that --output and path/file.out are two more positional arguments), but sops\sops-v3.7.3.exe --decrypt --age agekey --output path/file.out path/file.json will work.

Maybe that's the problem you're experiencing? The latest SOPS version warns about this situation BTW.

felixfontein avatar Dec 01 '24 09:12 felixfontein