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

AddressValueError: Expected 4 octets #7775

Closed
2 tasks done
burner1024 opened this issue Jun 16, 2022 · 3 comments
Closed
2 tasks done

AddressValueError: Expected 4 octets #7775

burner1024 opened this issue Jun 16, 2022 · 3 comments
Assignees
Labels
bug Something is broken.
Milestone

Comments

@burner1024
Copy link
Contributor

Describe the issue

An exception:
(actual IP addresses redacted)

AddressValueError: Expected 4 octets in '11.22.33.44,55.66.77.88'
  File "django/core/validators.py", line 302, in validate_ipv4_address
    ipaddress.IPv4Address(value)
  File "ipaddress.py", line 1308, in __init__
    self._ip = self._ip_int_from_string(addr_str)
  File "ipaddress.py", line 1195, in _ip_int_from_string
    raise AddressValueError("Expected 4 octets in %r" % ip_str)

Sentry shows the first IP as real one
Captura de pantalla de 2022-06-16 07-49-03

The second one, probably some proxy or something, not sure.
This happens infrequently.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

Set up Sentry. Get alerts.

Expected behavior

No exception.

Screenshots

No response

Exception traceback

AddressValueError: Expected 4 octets in '11.22.33.44,55.66.77.88'
  File "django/core/validators.py", line 302, in validate_ipv4_address
    ipaddress.IPv4Address(value)
  File "ipaddress.py", line 1308, in __init__
    self._ip = self._ip_int_from_string(addr_str)
  File "ipaddress.py", line 1195, in _ip_int_from_string
    raise AddressValueError("Expected 4 octets in %r" % ip_str)

ValidationError: ['Enter a valid IPv4 address.']
  File "django/core/validators.py", line 328, in validate_ipv46_address
    validate_ipv4_address(value)
  File "django/core/validators.py", line 304, in validate_ipv4_address
    raise ValidationError(

ValidationError: ['Enter a valid IPv6 address.']
  File "django/core/validators.py", line 331, in validate_ipv46_address
    validate_ipv6_address(value)
  File "django/core/validators.py", line 321, in validate_ipv6_address
    raise ValidationError(

ValidationError: ['Enter a valid IPv4 or IPv6 address.']
  File "weblate/middleware.py", line 67, in __call__
    validate_ipv46_address(address)
  File "django/core/validators.py", line 333, in validate_ipv46_address
    raise ValidationError(


### How do you run Weblate?

Docker container

### Weblate versions

 * Weblate: 4.12.2
 * Django: 4.0.4
 * siphashc: 2.1
 * translate-toolkit: 3.6.2
 * lxml: 4.6.5
 * Pillow: 9.1.0
 * bleach: 5.0.0
 * python-dateutil: 2.8.2
 * social-auth-core: 4.2.0
 * social-auth-app-django: 5.0.0
 * django-crispy-forms: 1.14.0
 * oauthlib: 3.2.0
 * django-compressor: 4.0
 * djangorestframework: 3.13.1
 * django-filter: 21.1
 * django-appconf: 1.0.5
 * user-agents: 2.2.0
 * filelock: 3.6.0
 * jellyfish: 0.9.0
 * openpyxl: 3.0.9
 * celery: 5.2.6
 * kombu: 5.2.4
 * translation-finder: 2.12
 * weblate-language-data: 2022.2
 * html2text: 2020.1.16
 * pycairo: 1.21.0
 * pygobject: 3.42.1
 * diff-match-patch: 20200713
 * requests: 2.27.1
 * django-redis: 5.2.0
 * hiredis: 2.0.0
 * sentry_sdk: 1.5.12
 * Cython: 0.29.28
 * misaka: 2.1.1
 * GitPython: 3.1.27
 * borgbackup: 1.2.0
 * pyparsing: 3.0.9
 * pyahocorasick: 1.4.4
 * python-redis-lock: 3.7.0
 * charset-normalizer: 2.0.12
 * Python: 3.10.4
 * Git: 2.30.2
 * psycopg2: 2.9.3
 * psycopg2-binary: 2.9.3
 * phply: 1.2.5
 * ruamel.yaml: 0.17.21
 * tesserocr: 2.5.2
 * akismet: 1.1
 * boto3: 1.22.11
 * zeep: 4.1.0
 * aeidon: 1.11
 * iniparse: 0.5
 * mysqlclient: 2.1.0
 * Mercurial: 6.1.2
 * git-svn: 2.30.2
 * git-review: 2.3.1
 * Redis server: 6.2.7
 * PostgreSQL server: 14.2
 * Database backends: django.db.backends.postgresql
 * Cache backends: default:RedisCache, avatar:FileBasedCache
 * Email setup: django.core.mail.backends.smtp.EmailBackend: email-smtp.us-east-1.amazonaws.com
 * OS encoding: filesystem=utf-8, default=utf-8
 * Celery: redis://cache:6379/1, redis://cache:6379/1, regular
 * Platform: Linux 4.15.0-176-generic (x86_64)


### Weblate deploy checks

```shell
System check identified some issues:

WARNINGS:
�[33;1m?: (security.W018) You should not have DEBUG set to True in deployment.�[0m

INFOS:
�[33;1m?: (weblate.I031) New Weblate version is available, please upgrade to 4.13.
	HINT: https://docs.weblate.org/en/weblate-4.12.2/admin/upgrade.html�[0m

System check identified 2 issues (2 silenced).

Additional context

No response

@nijel
Copy link
Member

nijel commented Jun 18, 2022

Is this error you get when something else is reported to Sentry, or this is the actual error?

Anyway, most likely, this is caused by wrong reverse proxy setup, see https://docs.weblate.org/en/latest/admin/install.html#reverse-proxy

@burner1024
Copy link
Contributor Author

This is the actual error emailed by Sentry to me.
The setup is cloudflare > nginx on host (ssl termination) > weblate in docker.
If there was something wrong with it, I'd get such alerts all the time, no? This happens once a week or so.

@nijel nijel self-assigned this Jun 20, 2022
@nijel nijel added this to the 4.13.1 milestone Jun 20, 2022
@nijel nijel added the bug Something is broken. label Jun 20, 2022
@nijel nijel closed this as completed in 9e65180 Jun 20, 2022
@github-actions
Copy link

Thank you for your report; the issue you have reported has just been fixed.

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken.
Projects
None yet
Development

No branches or pull requests

2 participants