-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to read the configuration file. Try to run the application with admin permission #873
Comments
Hi @sven-hergenhahn-dmtech, could you please share your |
Hi, as said, I also used the one provided by the documentation, that would be "project_id": "projectId"
"api_token": "personal-access-token"
"base_path": "."
"base_url": "https://api.crowdin.com"
"preserve_hierarchy": true
"files": [
{
"source": "/locale/en/folder1/[0-2].txt",
"translation": "/locale/%two_letters_code%/folder1/%original_file_name%"
},
] and my own one - adjusted a little bit for privacy: "project_id": "104"
"api_token": "some.very.long.token"
"base_path": "."
"base_url": "https://mycompany.api.crowdin.com"
# "preserve_hierarchy": true
"files": [
{
"source": "/source.json",
"translation": "/translations/%locale_with_underscore%.json",
}
] |
@sven-hergenhahn-dmtech Thanks for the details! Looking at the error message, it seems like it's a YML reading error, but I just tried both of your configuration files and couldn't reproduce it. Could you please try to recreate your config file and try the following syntax: project_id: "projectId"
api_token: "personal-access-token"
base_path: "."
base_url: "https://api.crowdin.com"
preserve_hierarchy: true
files:
- source: "/locale/en/folder1/[0-2].txt"
translation: "/locale/%two_letters_code%/folder1/%original_file_name%" |
did that, same result |
Does this happen with all CLI commands? |
well, I now tried
want me to test more? |
interestingly enough, when I delete/rename my crowdin.yml file, I get the same error. To me it seems like it does not detect the file at all... |
I think it might be using a different configuration file. Please check for example |
/opt/homebrew/Cellar/crowdin@4/4.4.1/bin/crowdin config lint --config ./crowdin.yml --debug also fails with the same error though |
all right, there was an old $HOME/.crowdin.yml that seems to have broken everything, even when explicitely specifying the local one. It only containes a line api_token:sometoken and some comments It works now, but I'd still cosider this a bug - specifically when providing a local config file as --config param, I'd expect the one in $HOME to be ignored. Thanks for your help anyway |
Glad to hear this is resolved now! The |
Looking at https://crowdin.github.io/crowdin-cli/configuration#split-project-configuration-and-api-credentials, the file is supposed to contain api_token lines - only mine was missing quotes for the value. Maybe it would be helpful to provide a better error message that also mentions all config files that were used to gather configuration information |
Describe the bug
A freshly installed crowdin (via brew as well as via crowdin-cli.zip and the install script) fails with
/opt/homebrew/opt/crowdin@4/bin/crowdin download sources
❌ Failed to read the configuration file. Try to run the application with admin permission
❌ class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap')
I have absolutely no idea what the problem might be here.
The directory has drwxr-xr-x and the crowdin file -rw-r--r-- which should IHMO be fine.
I also tested with the example crowdin.yml file which I expectecd to complain about a wrong project ID or api_token, but the error remains the same.
To Reproduce
Steps to reproduce the behavior:
brew install crowdin@4
/opt/homebrew/opt/crowdin@4/bin/crowdin -V # shows 4.1.1
cd folder_with_example_crowdin_file
/opt/homebrew/opt/crowdin@4/bin/crowdin pull --debug
Error:
java.lang.RuntimeException: Failed to read the configuration file. Try to run the application with admin permission
at com.crowdin.cli.utils.file.FileUtils.readYamlFile(FileUtils.java:39)
at com.crowdin.cli.properties.PropertiesBuilders.buildPropertiesWithFiles(PropertiesBuilders.java:17)
at com.crowdin.cli.commands.picocli.ActCommandWithFiles.getProperties(ActCommandWithFiles.java:25)
at com.crowdin.cli.commands.picocli.ActCommandWithFiles.getProperties(ActCommandWithFiles.java:11)
at com.crowdin.cli.commands.picocli.GenericActCommand.run(GenericActCommand.java:27)
at picocli.CommandLine.executeUserObject(CommandLine.java:2030)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
at picocli.CommandLine.execute(CommandLine.java:2174)
at com.crowdin.cli.commands.picocli.PicocliRunner.execute(PicocliRunner.java:38)
at com.crowdin.cli.Cli.main(Cli.java:16)
Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap')
at com.crowdin.cli.utils.file.FileUtils.readYamlFile(FileUtils.java:35)
... 14 more
Expected behavior
Run crowdin as expected
Environment:
openjdk 23.0.1 2024-10-15
OpenJDK Runtime Environment Homebrew (build 23.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 23.0.1, mixed mode, sharing)
Additional context
My config file works fine with the docker container:
The text was updated successfully, but these errors were encountered: