{"record":{"id":"6c3990f7972fd90b","repo":"thanos-io/thanos","slug":"unable-to-write-output","errorCode":null,"errorMessage":"unable to write output.","messagePattern":"unable to write output\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/tools_bucket.go","lineNumber":1021,"sourceCode":"\t\t\tstring(blockMeta.Thanos.Source))\n\n\t\tlines = append(lines, line)\n\t}\n\n\tvar sortByColNum []int\n\tfor _, col := range sortBy {\n\t\tindex := getIndex(header, col)\n\t\tif index == -1 {\n\t\t\treturn errors.Errorf(\"column %s not found\", col)\n\t\t}\n\t\tsortByColNum = append(sortByColNum, index)\n\t}\n\n\tt := Table{Header: header, Lines: lines, SortIndices: sortByColNum}\n\tsort.Sort(t)\n\terr := printer(os.Stdout, t)\n\tif err != nil {\n\t\treturn errors.Errorf(\"unable to write output.\")\n\t}\n\treturn nil\n}\n\nfunc getKeysAlphabetically(labels map[string]string) []string {\n\tvar keys []string\n\tfor k := range labels {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\treturn keys\n}\n\n// matchesSelector checks if blockMeta contains every label from\n// the selector with the correct value.\nfunc matchesSelector(blockMeta *metadata.Meta, selectorLabels labels.Labels) bool {\n\tmatches := true\n\tselectorLabels.Range(func(l labels.Label) {","sourceCodeStart":1003,"sourceCodeEnd":1039,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/tools_bucket.go#L1003-L1039","documentation":"Wraps the printer call that renders the metadata table to stdout after sorting. It fires when writing to standard output fails (broken pipe, closed terminal), so the computed table never reaches the user.","triggerScenarios":"Thrown at cmd/thanos/tools_bucket.go:1021 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure stdout is writable and not piped to a closed stream","Retry the command with output to a file"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}