Error when publishing actor?
# apify-platform
r
I try to publish my actor which is running fine locally using "apify run" - But when i publish the actor and try to run it i get this error on apify: Any idea why this is not working or even what this error means? Find attache also the full log - And below the main error message.
Copy code
View full log
2025-12-18T14:49:13.876Z   File "/usr/local/lib/python3.13/site-packages/pydantic/_internal/_model_construction.py", line 566, in set_model_fields
2025-12-18T14:49:13.877Z     fields, class_vars = collect_model_fields(cls, config_wrapper, ns_resolver, typevars_map=typevars_map)
2025-12-18T14:49:13.879Z                          ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-12-18T14:49:13.881Z   File "/usr/local/lib/python3.13/site-packages/pydantic/_internal/_fields.py", line 363, in collect_model_fields
2025-12-18T14:49:13.882Z     field_info = FieldInfo_.from_annotated_attribute(ann_type, assigned_value, _source=AnnotationSource.CLASS)
2025-12-18T14:49:13.884Z   File "/usr/local/lib/python3.13/site-packages/pydantic/fields.py", line 468, in from_annotated_attribute
2025-12-18T14:49:13.886Z     field_info = FieldInfo._construct(
2025-12-18T14:49:13.888Z         prepend_metadata + metadata if prepend_metadata is not None else metadata, **attr_overrides
2025-12-18T14:49:13.889Z     )
2025-12-18T14:49:13.891Z   File "/usr/local/lib/python3.13/site-packages/pydantic/fields.py", line 563, in _construct
2025-12-18T14:49:13.893Z     merged_field_info = cls(**merged_kwargs)
2025-12-18T14:49:13.894Z   File "/usr/local/lib/python3.13/site-packages/pydantic/fields.py", line 252, in __init__
2025-12-18T14:49:13.896Z     raise TypeError('cannot specify both default and default_factory')
2025-12-18T14:49:13.898Z TypeError: cannot specify both default and default_factory
https://cdn.discordapp.com/attachments/1451227384907829438/1451227385054892204/log.txt?ex=69456853&is=694416d3&hm=d1549c50165dc6af8f8cd03241d7eb7fcefc5bb1283604fd91dd73be9fc075bf&
a
message has been deleted
s
it's not apify error; it's pydantic v2 error. could you tell me your python version and pydantic version?
r
This are my pydantic versions in my local environment: pydantic 2.11.5 pydantic_core 2.33.2 pydantic-settings 2.12.0 And this is my python-version in my local environment: Python 3.13.5#
s
Your versions already match apify
maybe it could be caused by
pydantic-setting
.
r
What should i do with the pydantic-setting? Another version? Or do i have to check something in my code?
s
You should check your code
My problem especially is that this error only occurs when i pushed it to apify - it works fine locally running with python
Here the output when i run it locally: (apify) C:\DEV\Python-Diverses\Apify_Development\scrapeImages2>apify run - p Run: C:\DEV\.venv\apify\Scripts\python.exe -m src [apify] INFO Initializing Actor... [apify] INFO System info ({"apify_sdk_version": "2.5.0", "apify_client_version": "1.10.0", "crawlee_version": "0.6.9", "python_version": "3.13.3", "os": "win32"}) [apify] INFO [Status message]: Starting actor... [apify] INFO Enqueuing https://www.orf.at/ ... [apify] INFO Enqueuing https://rapidtech1898.com/ ... [apify] INFO Launching Chrome WebDriver... [apify] INFO Working for: https://www.orf.at/ [apify] INFO Overall 13 images found [apify] INFO Working for: https://rapidtech1898.com/ [apify] INFO Overall 5 images found [apify] INFO [Status message]: Actor finished... [apify] INFO Exiting Actor ({"exit_code": 0})
s
Your code does not contain the pydantic. Could you share your
apify.json
?
s
Hey, could you share your
input_schema.json
?
s
I see. The error is because of
prefill
in
input_schema.json
. Please remove the
prefill
fields in
input_schema.json
. Use like this.
Copy code
{
  "title": "Python Selenium Scraper",
  "type": "object",
  "schemaVersion": 1,
  "properties": {
    "start_urls": {
      "title": "Start URLs",
      "type": "array",
      "editor": "requestListSources",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "url"
        ]
      }
    },
    "image_extensions": {
      "title": "Allowed Image Extensions",
      "type": "array",
      "items": {
        "type": "string"
      },
      "editor": "stringList",
      "placeholder": [
        ".png",
        ".jpg",
        ".jpeg"
      ]
    },
    "text_included": {
      "title": "Text included in image-link",
      "type": "array",
      "items": {
        "type": "string"
      },
      "editor": "stringList",
      "placeholder": [
        "logo",
        "banner"
      ]
    }
  },
  "required": [
    "start_urls"
  ]
}
r
Thanks so much - unfortunately no i run in to this error: (when just trying the actor to run locally)
Copy code
(apify) C:\DEVNEU\Python-Diverses\Apify_Development\scrapeImages2>apify run -p
Error: Input schema is not valid (Property schema.properties.start_urls.items.url.format is not allowed.)
s
or
remove the
"format"
r
When i remove the format i get this:
Copy code
(apify) C:\DEVNEU\Python-Diverses\Apify_Development\scrapeImages2>apify run -p
Error: Input schema is not valid (Field schema.properties.start_urls.items.url.title is required)
s
You're right. insert the title in
start_urls
Copy code
"items": {
  "type": "object",
    "properties": {
      "url": {
        "title": "Current URL",
        "type": "string"
      }
    }
  }
}
Copy code
(apify) C:\DEVNEU\Python-Diverses\Apify_Development\scrapeImages2>apify run -p
Error: Input schema is not valid (Property schema.properties.image_extensions.placeholder is not allowed.)

(apify) C:\DEVNEU\Python-Diverses\Apify_Development\scrapeImages2>apify run -p
Error: Input schema is not valid (Field schema.properties.start_urls.items.url.description is required)

(apify) C:\DEVNEU\Python-Diverses\Apify_Development\scrapeImages2>apify run -p
Error: Input schema is not valid (Property schema.properties.image_extensions.placeholder is not allowed.)
But i still have the error when running this on apify
Copy code
2025-12-23T19:23:47.086Z   File "/usr/local/lib/python3.13/site-packages/pydantic/fields.py", line 563, in _construct
2025-12-23T19:23:47.086Z     merged_field_info = cls(**merged_kwargs)
2025-12-23T19:23:47.087Z   File "/usr/local/lib/python3.13/site-packages/pydantic/fields.py", line 252, in __init__
2025-12-23T19:23:47.087Z     raise TypeError('cannot specify both default and default_factory')
2025-12-23T19:23:47.088Z TypeError: cannot specify both default and default_factory
s
you need to have the
items
in
image_extensions
and
text_included
r
I put the items-element also in the image_extencions and text_include - but i still get the same error when running this on apify input_schema.json https://cdn.discordapp.com/attachments/1451227384907829438/1453295822572880033/input_schema.json?ex=694ceeb5&is=694b9d35&hm=70251c473f2fa676d39b10575b7f2b1eed86e25495972508b2539593209afa36&
s
It's very strange, I will check on my side with your code.
a
@RapidTech1898 just advanced to level 4! Thanks for your contributions! 🎉
r
I solved the problem this way - Installed a blank selenium actor with:
apify create my-actor -t python-selenium
s
Great. Thanks a lot for sharing the solution
a
@SnowFox just advanced to level 4! Thanks for your contributions! 🎉
2 Views