{"record":{"id":"cdd71f156ad544c5","repo":"grafana/k6","slug":"invalid-dependencies-manifest-w","errorCode":null,"errorMessage":"invalid dependencies manifest %w","messagePattern":"invalid dependencies manifest %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/launcher.go","lineNumber":465,"sourceCode":"\t\t\tif idx < 0 {\n\t\t\t\treturn result\n\t\t\t}\n\t\t\ti += width + idx + 2\n\t\tdefault:\n\t\t\treturn result\n\t\t}\n\t}\n\treturn result\n}\n\nfunc parseManifest(manifestString string) (dependencies, error) {\n\tif manifestString == \"\" {\n\t\treturn nil, nil //nolint:nilnil\n\t}\n\n\tmanifestMap := make(map[string]string)\n\tif err := json.Unmarshal([]byte(manifestString), &manifestMap); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid dependencies manifest %w\", err)\n\t}\n\treturn dependenciesFromMap(manifestMap)\n}\n\n// completionTimeout bounds the cache lookup for shell completion requests.\n// The build service is reachable but not guaranteed responsive; without a\n// deadline a stall would hang the shell on every TAB.\nconst completionTimeout = 3 * time.Second\n\n// completeExtension handles a shell completion request for an unregistered\n// extension subcommand. If the matching provisioned binary is already cached\n// locally, it delegates the completion request to that binary. Otherwise it\n// returns nil (no completions) so the shell does not hang waiting on a build.\nfunc completeExtension(gs *state.GlobalState, extName string, prov provisioner) error {\n\tdeps, err := dependenciesFromSubcommand(gs, extName)\n\tif err != nil {\n\t\tgs.Logger.WithError(err).Debug(\"Failed to build completion deps\")\n\t\treturn nil","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cmd/launcher.go#L447-L483","documentation":"Thrown by parseManifest when the dependency manifest string (typically the K6_DEPENDENCIES environment variable or the manifest captured from a built archive) is non-empty but is not a valid JSON object of dependency-name -> constraint-string pairs. json.Unmarshal fails on any JSON syntax error (truncated value, array instead of object, quotes issues) and the error is wrapped with this message. Note: a constraint string inside a syntactically valid JSON object that semver rejects fails later in dependenciesFromMap and is NOT covered by this wrap.","triggerScenarios":"Setting K6_DEPENDENCIES='{\"k6\": \">=v0.50\"' (missing closing brace), K6_DEPENDENCIES='k6>=v0.50' (not JSON), an array like '[\"k6\"]', or single-quoted keys; also loading an archive whose embedded manifest was corrupted.","commonSituations":"CI pipelines composing K6_DEPENDENCIES by string concatenation and forgetting a brace; shell quoting that strips inner double quotes; scripts that write the env var from YAML where quotes were normalized to single quotes.","solutions":["Echo the exact value: `echo \"$K6_DEPENDENCIES\"` and validate it as JSON: `echo \"$K6_DEPENDENCIES\" | jq .`","Rewrite as a JSON object mapping dependency to semver constraint: K6_DEPENDENCIES='{\"k6\": \">=v0.56.0\", \"k6/x/sql\": \"0.x\"}'","Use double quotes for keys/values and single quotes around the whole env var in POSIX shells","If the error appears when loading an archive, rebuild the archive (k6 archive script.js) instead of hand-editing its manifest"],"exampleFix":"# before\nexport K6_DEPENDENCIES='{\"k6\": \">=v0.56.0''\n# error: invalid dependencies manifest ...\n\n# after\nexport K6_DEPENDENCIES='{\"k6\": \">=v0.56.0\"}'","handlingStrategy":"validation","validationCode":"# Validate K6_DEPENDENCIES is a JSON object of dep->range before k6 reads it\nnode -e '\nconst m = process.env.K6_DEPENDENCIES; if (!m) process.exit(0);\nconst o = JSON.parse(m);\nif (Array.isArray(o) || typeof o !== \"object\") process.exit(1);\n' || { echo 'K6_DEPENDENCIES must be a JSON object'; exit 1; }","typeGuard":"function isDependenciesManifest(v) {\n  if (typeof v !== \"string\" || v === \"\") return false;\n  try { const o = JSON.parse(v); return !!o && typeof o === \"object\" && !Array.isArray(o); }\n  catch { return false; }\n}","tryCatchPattern":null,"preventionTips":["Generate K6_DEPENDENCIES programmatically (jq -n / JSON.stringify), never by string concatenation","Single-quote the whole env var and double-quote inside it in POSIX shells","Validate the value with jq in the pipeline before the k6 step"],"tags":["json","dependencies","env","manifest"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}