{"id":"36e6d590aa086350","repo":"docker/cli","slug":"bad-format-for-links-s","errorCode":null,"errorMessage":"bad format for links: %s","messagePattern":"bad format for links: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"opts/opts.go","lineNumber":381,"sourceCode":"\t}\n\tnano := cpu.Mul(cpu, big.NewRat(1e9, 1))\n\tif !nano.IsInt() {\n\t\treturn 0, errors.New(\"value is too precise\")\n\t}\n\treturn nano.Num().Int64(), nil\n}\n\n// ParseLink parses and validates the specified string as a link format (name:alias)\nfunc ParseLink(val string) (string, string, error) {\n\tif val == \"\" {\n\t\treturn \"\", \"\", errors.New(\"empty string specified for links\")\n\t}\n\t// We expect two parts, but restrict to three to allow detecting invalid formats.\n\tarr := strings.SplitN(val, \":\", 3)\n\n\t// TODO(thaJeztah): clean up this logic!!\n\tif len(arr) > 2 {\n\t\treturn \"\", \"\", errors.New(\"bad format for links: \" + val)\n\t}\n\t// TODO(thaJeztah): this should trim the \"/\" prefix as well??\n\tif len(arr) == 1 {\n\t\treturn val, val, nil\n\t}\n\t// This is kept because we can actually get a HostConfig with links\n\t// from an already created container and the format is not `foo:bar`\n\t// but `/foo:/c1/bar`\n\tif strings.HasPrefix(arr[0], \"/\") {\n\t\t// TODO(thaJeztah): clean up this logic!!\n\t\t_, alias := path.Split(arr[1])\n\t\treturn arr[0][1:], alias, nil\n\t}\n\treturn arr[0], arr[1], nil\n}\n\n// ValidateLink validates that the specified string has a valid link format (containerName:alias).\nfunc ValidateLink(val string) (string, error) {","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/opts/opts.go#L363-L399","documentation":"Error \"bad format for links: %s\" thrown in docker/cli.","triggerScenarios":"Thrown at opts/opts.go:381 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}