{"record":{"id":"94cc5219020bcf51","repo":"navidrome/navidrome","slug":"generating-rust-client-code-for-s-w","errorCode":null,"errorMessage":"generating Rust client code for %s: %w","messagePattern":"generating Rust client code for (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/cmd/ndpgen/main.go","lineNumber":712,"sourceCode":"\t\tif verbose {\n\t\t\tfmt.Printf(\"Generated Rust lib.rs: %s\\n\", libPath)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// generateAllCode generates all requested code for the services.\nfunc generateAllCode(cfg *config, services []internal.Service) error {\n\tfor _, svc := range services {\n\t\tif cfg.generateGoClient {\n\t\t\tif err := generateGoClientCode(svc, cfg.goOutputDir, cfg.pkgName, cfg.dryRun, cfg.verbose); err != nil {\n\t\t\t\treturn fmt.Errorf(\"generating Go client code for %s: %w\", svc.Name, err)\n\t\t\t}\n\t\t}\n\t\tif cfg.generateRsClient {\n\t\t\tif err := generateRustClientCode(svc, cfg.rustOutputDir, cfg.dryRun, cfg.verbose); err != nil {\n\t\t\t\treturn fmt.Errorf(\"generating Rust client code for %s: %w\", svc.Name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif cfg.generateRsClient && len(services) > 0 {\n\t\tif err := generateRustLibFile(services, cfg.rustOutputDir, cfg.dryRun, cfg.verbose); err != nil {\n\t\t\treturn fmt.Errorf(\"generating Rust lib.rs: %w\", err)\n\t\t}\n\t}\n\n\tif cfg.generateGoClient && len(services) > 0 {\n\t\tif err := generateGoDocFile(services, cfg.goOutputDir, cfg.pkgName, cfg.dryRun, cfg.verbose); err != nil {\n\t\t\treturn fmt.Errorf(\"generating Go doc.go: %w\", err)\n\t\t}\n\t\tif err := generateGoModFile(cfg.goOutputDir, cfg.dryRun, cfg.verbose); err != nil {\n\t\t\treturn fmt.Errorf(\"generating Go go.mod: %w\", err)\n\t\t}\n\t\t// Generate PDK abstraction layer alongside host client code","sourceCodeStart":694,"sourceCodeEnd":730,"githubUrl":"https://github.com/navidrome/navidrome/blob/4ed7494a3293a9e9e647897ebfb9be327efd981b/plugins/cmd/ndpgen/main.go#L694-L730","documentation":"generateAllCode wraps any error from generateRustClientCode for a service with the service name. The root cause is inside Rust client generation (GenerateCapabilityRust-style failures or file writes) for that service.","triggerScenarios":"cfg.generateRsClient is set and generateRustClientCode(svc, cfg.rustOutputDir, ...) returns an error — unsupported field type mapping to Rust, invalid service name in module naming, or write failure in rustOutputDir.","commonSituations":"Service schema uses types with no Rust equivalent; rustOutputDir is read-only or missing; name collisions between services after snake_casing module names.","solutions":["Read the inner wrapped error for the precise cause","Check the failing service's field types against the generator's Rust mappings","Verify rustOutputDir exists and is writable","Re-run with --dry-run to isolate generation vs. write failures"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if cfg.generateRsClient {\n    if st, err := os.Stat(cfg.rustOutputDir); err != nil || !st.IsDir() {\n        os.MkdirAll(cfg.rustOutputDir, 0755)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := generateRustClientCode(svc, cfg.rustOutputDir, cfg.dryRun, cfg.verbose); err != nil {\n    return fmt.Errorf(\"generating Rust client code for %s: %w\", svc.Name, err)\n} // unwrap to find whether generation or the write failed","preventionTips":["Pre-create and pre-permission the Rust output directory","Deduplicate service names before generation","Validate all service field types against Rust mappings upfront"],"tags":["go","rust","codegen","client","wrapper-error"],"backgroundTag":"code-generation-type-mapping-failure","analyzedSha":"4ed7494a3293a9e9e647897ebfb9be327efd981b","analyzedAt":"2026-09-01T05:03:05.018Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}