{"record":{"id":"9d7bef5950129911","repo":"pulumi/pulumi","slug":"sha1-requires-an-input-argument","errorCode":null,"errorMessage":"sha1 requires an input argument","messagePattern":"sha1 requires an input argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/pcl/runtime/builtinFunctions.go","lineNumber":987,"sourceCode":"\t\t\tdecodedBytes, err := base64.StdEncoding.DecodeString(data)\n\t\t\tif err != nil {\n\t\t\t\treturn cty.NilVal, fmt.Errorf(\"invalid base64 data: %w\", err)\n\t\t\t}\n\t\t\treturn cty.StringVal(string(decodedBytes)), nil\n\t\t},\n\t})\n\n\tsha1Fn := function.New(&function.Spec{\n\t\tParams: []function.Parameter{\n\t\t\t{\n\t\t\t\tName: \"input\",\n\t\t\t\tType: cty.String,\n\t\t\t},\n\t\t},\n\t\tType: function.StaticReturnType(cty.String),\n\t\tImpl: func(args []cty.Value, retType cty.Type) (cty.Value, error) {\n\t\t\tif len(args) != 1 {\n\t\t\t\treturn cty.NilVal, errors.New(\"sha1 requires an input argument\")\n\t\t\t}\n\t\t\tif args[0].Type() != cty.String {\n\t\t\t\treturn cty.NilVal, errors.New(\"sha1 input argument must be a string\")\n\t\t\t}\n\t\t\th := sha1.Sum([]byte(args[0].AsString())) //nolint:gosec // we don't need a strong cryptographic primitive\n\t\t\treturn cty.StringVal(hex.EncodeToString(h[:])), nil\n\t\t},\n\t})\n\n\ttoJSONFn := function.New(&function.Spec{\n\t\tParams: []function.Parameter{\n\t\t\t{\n\t\t\t\tName:             \"value\",\n\t\t\t\tType:             cty.DynamicPseudoType,\n\t\t\t\tAllowMarked:      true,\n\t\t\t\tAllowNull:        true,\n\t\t\t\tAllowDynamicType: true,\n\t\t\t},","sourceCodeStart":969,"sourceCodeEnd":1005,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/pcl/runtime/builtinFunctions.go#L969-L1005","documentation":"The PCL sha1 builtin computes the SHA-1 hex digest of a string input. It throws this error when the function is invoked without exactly one argument in the args slice — typically zero arguments. The check runs before any type inspection.","triggerScenarios":"Calling sha1() with no arguments in a PCL program evaluated by the pcl runtime builtinFunctions registry.","commonSituations":"Accidentally deleting the argument while editing; a template interpolation that renders to zero arguments; copy-paste of the function name without filling in the input.","solutions":["Pass exactly one argument: sha1(value)","If the input comes from a computed expression, ensure it is not dropped/empty before invocation"],"exampleFix":"// before\nsha1()\n// after\nsha1(\"hello\")","handlingStrategy":"validation","validationCode":"// ensure exactly one argument at the call site: sha1(input)\nif arg == nil { panic(\"sha1 requires one argument\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never call sha1() empty — always supply the value to hash","Review refactors that may drop positional arguments"],"tags":["pcl","sha1","missing-argument"],"backgroundTag":"missing-function-argument","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}