{"record":{"id":"563578c0dd30cc77","repo":"docusealco/docuseal","slug":"invalid-type-value","errorCode":null,"errorMessage":"Invalid #{type} value","messagePattern":"Invalid #(.+?) value","errorType":"validation","errorClass":"Submitters::NormalizeValues::InvalidDefaultValue","httpStatus":422,"severity":"error","filePath":"lib/submitters/normalize_values.rb","lineNumber":205,"sourceCode":"          attachments.find { |a| a.blob_id == new_attachment.blob_id } || new_attachment\n        end\n\n        [new_attachments.map(&:uuid), new_attachments]\n      else\n        new_attachment = find_or_build_attachment(value, field, account, for_submitter:, purpose:)\n\n        existing_attachment = attachments.find { |a| a.blob_id == new_attachment.blob_id }\n\n        attachment = existing_attachment || new_attachment\n\n        [attachment.uuid, attachment]\n      end\n    end\n\n    def find_or_build_attachment(value, field, account, for_submitter: nil, purpose: nil)\n      type = field['type']\n\n      raise InvalidDefaultValue, \"Invalid #{type} value\" if purpose == :bulk\n\n      blob =\n        if value.match?(%r{\\Ahttps?://})\n          raise InvalidDefaultValue, \"Invalid #{type} value\" unless purpose == :api\n\n          find_or_create_blob_from_url(account, value)\n        elsif type.in?(%w[signature initials]) && value.length < 60\n          find_or_create_blob_from_text(account, value, type)\n        elsif (data = Base64.decode64(value.sub(BASE64_PREFIX_REGEXP, ''))) &&\n              (mime_type = Marcel::MimeType.for(data)).exclude?('octet-stream')\n          find_or_create_blob_from_base64(account, data, type, mime_type:)\n        elsif type == 'image' && (value.starts_with?('<html>') || value.starts_with?('<!DOCTYPE'))\n          raise InvalidDefaultValue, \"Invalid #{type} value\" unless purpose == :api\n\n          find_or_create_blob_from_html(account, value, field)\n        else\n          raise InvalidDefaultValue, \"Invalid value, url, base64 or text < 60 chars is expected: #{value.first(200)}...\"\n        end","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/docusealco/docuseal/blob/004a22c1c88109c7ba0b567df011a8cb13894001/lib/submitters/normalize_values.rb#L187-L223","documentation":"Submitters::NormalizeValues#find_or_build_attachment (lib/submitters/normalize_values.rb:205) raises InvalidDefaultValue 'Invalid <type> value' unconditionally when purpose == :bulk. Attachment-typed fields (signature, initials, image, stamp, file...) simply cannot carry preset values through the bulk/CSV import path — the guard fires before any format inspection of the value.","triggerScenarios":"Bulk submission creation (CSV import) whose per-signer values column contains a value for a signature/image/stamp/file field; any code path calling NormalizeValues with purpose: :bulk and a default/field value for an attachment field.","commonSituations":"CSV templates exported from the API examples including attachment columns; customers migrating paper workflows expecting pre-filled signature images; integrations reusing the same payload for the API and the bulk importer.","solutions":["Remove attachment-field values (signature, initials, image, stamp, file) from bulk import payloads — leave those fields for signers to complete.","Use the JSON API (purpose :api) to pre-fill attachments via base64 or URL, where they are supported.","Validate your CSV/attrs against template field types before submitting and drop unsupported columns client-side."],"exampleFix":"# before (bulk import row with attachment value)\n{ 'submitters' => [{ 'email' => 'a@b.c', 'values' => { signature_field_uuid => 'data:image/png;base64,...' } }] }\n\n# after (attachment left for the signer)\n{ 'submitters' => [{ 'email' => 'a@b.c', 'values' => { text_field_uuid => 'John' } }] }","handlingStrategy":"validation","validationCode":"# Strip attachment-typed field values before any bulk import\nATTACHMENT_TYPES = %w[signature initials image stamp file].freeze\n\ndef bulk_safe?(template_fields, values)\n  values.keys.none? do |uuid|\n    (f = template_fields.find { |e| e['uuid'] == uuid }) && ATTACHMENT_TYPES.include?(f['type'])\n  end\nend","typeGuard":null,"tryCatchPattern":"begin\n  Submissions::CreateFromSubmitters.call(template:, user:, submissions_attrs:, source: 'bulk', submitters_order:)\nrescue Submitters::NormalizeValues::InvalidDefaultValue => e\n  render json: { error: e.message }, status: :unprocessable_entity\nend","preventionTips":["Never include signature/image/file columns in bulk/CSV payloads.","Filter values by template field type client-side before import.","Use the JSON API (purpose :api) when pre-filled attachments are required."],"tags":["docuseal","bulk-import","default-value","params-validation"],"backgroundTag":"default-value-validation-failed","analyzedSha":"004a22c1c88109c7ba0b567df011a8cb13894001","analyzedAt":"2026-08-21T13:38:23.343Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}