Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: value too long for type character varying(100) #1537

Open
tdruez opened this issue Jan 15, 2025 · 0 comments
Open

BUG: value too long for type character varying(100) #1537

tdruez opened this issue Jan 15, 2025 · 0 comments

Comments

@tdruez
Copy link
Contributor

tdruez commented Jan 15, 2025

While running a d2d pipeline on the following inputs:

https://github.com/tchiotludo/akhq/archive/refs/tags/0.25.1.zip#from
https://github.com/tchiotludo/akhq/releases/download/0.25.1/akhq-0.25.1-all.jar#to

Pipeline failure:

value too long for type character varying(100)

Traceback:
  File "/Volumes/nexB/repos/scancode.io/aboutcode/pipeline/__init__.py", line 199, in execute
    step(self)
  File "/Volumes/nexB/repos/scancode.io/scanpipe/pipelines/deploy_to_develop.py", line 145, in collect_and_create_codebase_resources
    pipes.collect_and_create_codebase_resources(self.project)
  File "/Volumes/nexB/repos/scancode.io/scanpipe/pipes/__init__.py", line 129, in collect_and_create_codebase_resources
    model_class.objects.bulk_create(batch, batch_size)
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 835, in bulk_create
    returned_columns = self._batched_insert(
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1875, in _batched_insert
    self._insert(
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1847, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1836, in execute_sql
    cursor.execute(sql, params)
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/debug_toolbar/panels/sql/tracking.py", line 235, in execute
    return self._record(super().execute, sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/debug_toolbar/panels/sql/tracking.py", line 160, in _record
    return method(sql, params)
           ^^^^^^^^^^^^^^^^^^^
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 122, in execute
    return super().execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 79, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 100, in _execute
    with self.db.wrap_database_errors:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/nexB/repos/scancode.io/.venv/lib/python3.12/site-packages/psycopg/cursor.py", line 97, in execute
    raise ex.with_traceback(None)

This is caused by the following file: to/META-INF/micronaut/io.micronaut.inject.BeanDefinitionReference/io.micronaut.http.client.$ServiceHttpClientConfiguration$ServiceSslClientConfiguration$DefaultTrustStoreConfiguration$Definition$Reference

The extension field value is provided as .$ServiceHttpClientConfiguration$ServiceSslClientConfiguration$DefaultTrustStoreConfiguration$Definition$Reference in the batch_create and fails since the extension field max length is 100.

from scanpipe.models import Project, CodebaseResource
project = Project.objects.all()[0]

relative_path = "to/META-INF/micronaut/io.micronaut.inject.BeanDefinitionReference/io.micronaut.http.client.$ServiceHttpClientConfiguration$ServiceSslClientConfiguration$DefaultTrustStoreConfiguration$Definition$Reference"

resource_data = {'type': CodebaseResource.Type.FILE, 'name': 'io.micronaut.http.client.$ServiceHttpClientConfiguration$ServiceSslClientConfiguration$DefaultTrustStoreConfiguration$Definition$Reference', 'extension': '.$ServiceHttpClientConfiguration$ServiceSslClientConfiguration$DefaultTrustStoreConfiguration$Definition$Reference', 'mime_type': 'inode/x-empty', 'file_type': 'empty', 'is_text': True, 'tag': 'to'}

codebase_resource = CodebaseResource(
    project=project,
    path=relative_path,
    **resource_data,
    )
codebase_resource.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant