{"record":{"id":"acd2836ac3c82097","repo":"golang/go","slug":"unable-to-determine-os-version-w","errorCode":null,"errorMessage":"unable to determine OS version: %w","messagePattern":"unable to determine OS version: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/cmd/internal/osinfo/os_wasip1.go","lineNumber":16,"sourceCode":"// Copyright 2023 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build wasip1\n\npackage osinfo\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n)\n\n// Version returns the OS version name/number.\nfunc Version() (string, error) {\n\treturn \"\", fmt.Errorf(\"unable to determine OS version: %w\", errors.ErrUnsupported)\n}\n","sourceCodeStart":1,"sourceCodeEnd":18,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/osinfo/os_wasip1.go#L1-L18","documentation":"On the wasip1 target there is no portable host API to query the OS version, so osinfo.Version() returns errors.ErrUnsupported wrapped in this message. It is a deliberate 'not implemented' rather than a transient failure.","triggerScenarios":"Calling osinfo.Version() in any wasip1 build.","commonSituations":"Standard behavior for Go programs compiled for wasip1 that call into osinfo (directly or transitively). Not a defect.","solutions":["Handle errors.ErrUnsupported gracefully in the caller.","Do not depend on a host OS version when targeting wasip1."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":"// Detect wasip1 and skip version-dependent behavior.\n// if v, err := osinfo.Version(); err != nil {\n//     if errors.Is(err, errors.ErrUnsupported) {\n//         // wasip1: host version unavailable; use a static label\n//     }\n// }","tryCatchPattern":"// v, err := osinfo.Version()\n// if err != nil {\n//     if errors.Is(err, errors.ErrUnsupported) {\n//         v = \"unknown (wasip1)\"\n//     } else {\n//         return err\n//     }\n// }","preventionTips":["Never depend on a host OS version when targeting wasip1.","Handle errors.ErrUnsupported explicitly.","Use a static fallback label for wasip1 telemetry."],"tags":["wasm","wasip1","osinfo","version","unsupported"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}