openfga / openfga/cli

CLI silently ignores .fga.yaml config file when YAML parsing fails

Open
#608 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
102
Forks
49
Avg merge
1d 1h
Merged PRs (30d)
16

Description

Description

The OpenFGA CLI silently ignores the .fga.yaml configuration file when it contains invalid YAML syntax (such as tab characters), leading to confusing debugging sessions where the CLI appears to ignore the configuration without any error message.

Current Behavior

When a .fga.yaml file exists but contains invalid YAML (e.g., tab characters instead of spaces), the CLI:

  • Does not throw any error or warning
  • Silently falls back to other configuration sources (flags/environment variables)
  • Gives no indication that the config file was found but failed to parse
  • Proceeds as if the config file doesn't exist
Expected Behavior

When a .fga.yaml configuration file is found but fails to parse, the CLI should:

  • Display a clear error message indicating the config file was found but couldn't be parsed
  • Show the file path that was attempted
  • Provide helpful information about the parsing error (e.g., "YAML does not support tab characters")
  • Exit with a non-zero status code or at least warn the user
Steps to Reproduce
  1. Create a .fga.yaml file with the following content (note: use a TAB character for indentation instead of spaces):
api-url: https://api.example.com
store-id: 12345678
<TAB>api-token: your-token-here
  1. Try to run any CLI command that uses configuration:
fga store list
  1. Observe that the CLI doesn't use the config file and doesn't report any error
Additional Context

According to YAML FAQ #2, tabs are not allowed in YAML, but this is easy to miss when creating config files manually or when copying examples.

Suggested Fix

Add validation for the config file loading process that:
If parsing fails, outputs a helpful error message.

Impact

Developer Experience (DX): This improvement would save developers debugging time and frustration. Good error messages are critical for CLI tools.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the invalid .fga.yaml case with fga store list, then trace the CLI configuration-loading path. Confirm how parse failures are currently handled and define completion as a clear path-specific error or warning with a non-success outcome instead of silent fallback.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.