{"record":{"id":"a18e758c2900e648","repo":"netbirdio/netbird","slug":"generate-debug-bundle-w","errorCode":null,"errorMessage":"generate debug bundle: %w","messagePattern":"generate debug bundle: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/android/client.go","lineNumber":342,"sourceCode":"\t\t\t}\n\t\t\tif cm := e.GetClientMetrics(); cm != nil {\n\t\t\t\tdeps.ClientMetrics = cm\n\t\t\t}\n\t\t}\n\t}\n\n\tbundleGenerator := debug.NewBundleGenerator(\n\t\tdeps,\n\t\tdebug.BundleConfig{\n\t\t\tAnonymize:         anonymize,\n\t\t\tAnonymizeLevel:    nbAnonymize.ParseLevel(anonymizeLevel),\n\t\t\tIncludeSystemInfo: true,\n\t\t},\n\t)\n\n\tpath, err := bundleGenerator.Generate()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"generate debug bundle: %w\", err)\n\t}\n\tdefer func() {\n\t\tif err := os.Remove(path); err != nil {\n\t\t\tlog.Errorf(\"failed to remove debug bundle file: %v\", err)\n\t\t}\n\t}()\n\n\tuploadCtx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)\n\tdefer cancel()\n\n\tkey, err := debug.UploadDebugBundle(uploadCtx, types.DefaultBundleURL, cfg.ManagementURL.String(), path, false)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"upload debug bundle: %w\", err)\n\t}\n\n\tlog.Infof(\"debug bundle uploaded with key %s\", key)\n\treturn key, nil\n}","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/android/client.go#L324-L360","documentation":"In Android DebugBundle, after dependencies are gathered, debug.NewBundleGenerator().Generate() collects logs and system info and writes the archive into the configured TempDir (the platform cache dir). Any failure in that collection or write is wrapped as this error, with the underlying cause preserved via %w.","triggerScenarios":"The cache dir (platformFiles.CacheDir()) missing, evicted, or read-only; disk full while writing the archive; a source file the generator reads (state file, status) disappearing mid-collection.","commonSituations":"Android evicting the cache directory while the app is backgrounded; low-storage devices; file-permission changes after an app update.","solutions":["Ensure the cache directory exists and is writable before triggering the debug bundle.","Free disk space on the device and retry.","Inspect the wrapped cause with errors.Unwrap or %-v formatting to identify the failing file."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure the bundle output directory exists before generating\nif err := os.MkdirAll(cacheDir, 0o700); err != nil {\n    return fmt.Errorf(\"prepare cache dir: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"path, err := client.DebugBundle(files, true, \"anonymize\")\nif err != nil && strings.HasPrefix(err.Error(), \"generate debug bundle:\") {\n    // disk/cache problem: free space, verify cache dir writable, then retry once\n}","preventionTips":["Create and keep a stable cache directory instead of relying on Android's evictable cache.","Check available disk space before generating bundles on low-storage devices.","Log errors.Unwrap of the returned error to pinpoint the failing collection step."],"tags":["android","debug","file-io","disk"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}