{"record":{"id":"1d6f17e2fd5443f2","repo":"docker/compose","slug":"arguments-to-filter-should-be-in-form-key-val","errorCode":null,"errorMessage":"arguments to --filter should be in form KEY=VAL","messagePattern":"arguments to --filter should be in form KEY=VAL","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/compose/ps.go","lineNumber":55,"sourceCode":"type psOptions struct {\n\t*ProjectOptions\n\tFormat   string\n\tAll      bool\n\tQuiet    bool\n\tServices bool\n\tFilter   string\n\tStatus   []string\n\tnoTrunc  bool\n\tOrphans  bool\n}\n\nfunc (p *psOptions) parseFilter() error {\n\tif p.Filter == \"\" {\n\t\treturn nil\n\t}\n\tkey, val, ok := strings.Cut(p.Filter, \"=\")\n\tif !ok {\n\t\treturn errors.New(\"arguments to --filter should be in form KEY=VAL\")\n\t}\n\tswitch key {\n\tcase \"status\":\n\t\tp.Status = append(p.Status, val)\n\t\treturn nil\n\tcase \"source\":\n\t\treturn api.ErrNotImplemented\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown filter %s\", key)\n\t}\n}\n\nfunc psCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions) *cobra.Command {\n\topts := psOptions{\n\t\tProjectOptions: p,\n\t}\n\tpsCmd := &cobra.Command{\n\t\tUse:   \"ps [OPTIONS] [SERVICE...]\",","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/cmd/compose/ps.go#L37-L73","documentation":"docker compose ps --filter accepts a single KEY=VAL string. parseFilter in cmd/compose/ps.go uses strings.Cut on '='; if no '=' separates key and value, the error is returned before any key-specific handling. Valid keys are 'status' (value appended to Status list) and 'source' (currently api.ErrNotImplemented); any other key yields 'unknown filter <key>'.","triggerScenarios":"`docker compose ps --filter running`, `--filter status` (missing =VAL), or `--filter paused` (missing value). Note the ps filter flag is a plain string, so only one --filter is honored and it must contain '='.","commonSituations":"Carrying over docker ps habits (`docker ps --filter status=running` works, but omitting the '=' form is common in hastily written scripts); shell variables that expand to a bare word without the =VAL part.","solutions":["Rewrite the filter as KEY=VAL, e.g. `--filter status=running`.","Verify the key is one of the supported ones: status (or source, which is not yet implemented).","For multiple statuses, repeat the flag: `--filter status=running --filter status=paused`."],"exampleFix":"# before\ndocker compose ps --filter running\n\n# after\ndocker compose ps --filter status=running","handlingStrategy":"validation","validationCode":"# compose ps filter must be KEY=VAL with key in {status,source}\ncase \"$FILTER\" in\n  status=*|source=*) docker compose ps --filter \"$FILTER\" ;;\n  *) echo \"filter must be status=VAL or source=VAL (KEY=VAL form)\" >&2; exit 1 ;;\nesac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write ps filters in KEY=VAL form; validate with a case pattern before running.","Remember only one --filter string is parsed by ps (unlike docker ps)."],"tags":["cli","ps","filter","validation"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}