{"record":{"id":"17822b2c1dfa39ef","repo":"hasura/graphql-engine","slug":"expected-0-arguments-found-v","errorCode":null,"errorMessage":"expected 0 arguments, found: %v","messagePattern":"expected 0 arguments, found: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/commands/metadata_handlers.go","lineNumber":423,"sourceCode":"\t}\n\n\tif len(o.rawOutput) != 0 {\n\t\t// if not a dry run fetch metadata from and server and print it to stdout\n\t\terr := getMetadataFromServerAndWriteToStdoutByFormat(o.EC, rawOutputFormat(o.rawOutput))\n\t\tif err != nil {\n\t\t\treturn errors.E(op, err)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\treturn nil\n}\n\nfunc diff(o *MetadataDiffOptions, diffType DiffType) error {\n\tvar op errors.Op = \"commands.diff\"\n\tif len(o.Args) > 0 {\n\t\treturn errors.E(op, fmt.Errorf(\"expected 0 arguments, found: %v\", o.Args))\n\t}\n\n\tserverMetadata, err := cli.GetCommonMetadataOps(o.EC).ExportMetadata()\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"exporting metadata from server: %w\", err))\n\t}\n\n\tvar serverMetadataBytes []byte\n\n\tserverMetadataBytes, err = io.ReadAll(serverMetadata)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"reading server metadata: %w\", err))\n\t}\n\n\tif diffType == DifftypeYAML {\n\t\tserverMetadataBytes, err = metadatautil.JSONToYAML(serverMetadataBytes)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"parsing server metadata as yaml: %w\", err))","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/metadata_handlers.go#L405-L441","documentation":"The `metadata diff` command takes no positional arguments. This error is a usage validation failure: extra arguments were supplied on the command line and the CLI rejects them before doing any work.","triggerScenarios":"Running `metadata diff something` (any positional argument after the subcommand) — e.g. trying to diff against a specified file via `metadata diff ./mymetadata.yaml`, which the command does not support; the metadata file must come from config.","commonSituations":"Users assuming diff accepts a file argument (common CLI convention elsewhere); copy-pasted commands from tutorials with an extra token; shell glob expansion appending an unexpected word.","solutions":["Remove all positional arguments — diff always compares the configured metadata file against the server","To diff a specific file, either update the config's metadata file path or temporarily point --metadata-file (if supported by your CLI version) at the file","Check `metadata diff --help` for the exact accepted flags"],"exampleFix":"# before\nhasura metadata diff ./metadata.yaml  # expected 0 arguments, found: [./metadata.yaml]\n# after\nhasura metadata diff  # uses the metadata file from config","handlingStrategy":"validation","validationCode":"if len(os.Args) > afterSubcommandIdx {\n  return errors.New(\"metadata diff takes no positional arguments; configure the metadata file path instead\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check `--help` for accepted arguments before scripting","Remember diff uses the config's metadata file — it takes no file argument","Wrap commands in scripts that validate argument counts"],"tags":["metadata","diff","cli-usage","arguments"],"backgroundTag":"invalid-command-usage","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}