# AttributeError: 'NoneType' object has no attribute 'year'

**URL:** <https://discuss.openedx.org/t/attributeerror-nonetype-object-has-no-attribute-year/16009>\
**Category:** Site Operators\
**Created:** [May 22, 2025, 4:50pm UTC](https://discuss.openedx.org/t/attributeerror-nonetype-object-has-no-attribute-year/16009 "2025-05-22T16:50:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbernesto](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/sbernesto/32/90_2.png) [@sbernesto](https://discuss.openedx.org/u/sbernesto)\
**Post date:** [May 22, 2025, 4:50pm UTC](https://discuss.openedx.org/t/attributeerror-nonetype-object-has-no-attribute-year/16009/1 "2025-05-22T16:50:06Z")

</div>

Hi,

Recently, we’ve been receiving the following error on the platform:

`AttributeError: 'NoneType' object has no attribute 'year' `

Causing the course to not be displayed.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/8/8725da8a1e92fcebb165388c785697768f968a9b.png)

We’ve already checked the course to ensure the dates are correct, but even after changing them, the error persists.

The version we’re using is:  
tutor, version 18.1.1

I found this post, but it hasn’t been commented on or resolved.

> [@I am getting error 500 on the course](https://discuss.openedx.org/t/i-am-getting-error-500-on-the-course/14686/11):
>
> Here is the logs: tutor\_local-cms-1 | [pid: 16|app: 0|req: 1043/2379] 172.18.0.2 () {62 vars in 4055 bytes} [Thu Jan 30 07:19:47 2025] GET /api/courses/v1/validation/course-v1:Decimal+VCD-Vahana-Cloud-1.x+2024\_M10/?graded\_only=true&validate\_oras=true&all=true =\> generated 562 bytes in 178 msecs (HTTP/1.1 200) 9 headers in 469 bytes (1 switches on core 0) tutor\_local-cms-1 | 2025-01-30 07:19:47,966 ERROR 1 [root] [user None] [ip None] signals.py:22 - Uncaught exception from None tutor\_local-…

Is there a way to resynchronize course dates? Or what steps could I take to correct this problem, since I have students currently taking the course.

---

<div class="post-metadata">

**Author:** ![Anh\_Vu\_Nguy\_n](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/anh_vu_nguy_n/32/1740_2.png) [@Anh\_Vu\_Nguy\_n](https://discuss.openedx.org/u/Anh_Vu_Nguy_n)\
**Post date:** [May 23, 2025, 1:58am UTC](https://discuss.openedx.org/t/attributeerror-nonetype-object-has-no-attribute-year/16009/2 "2025-05-23T01:58:38Z")

</div>

This could be because sections or subsections do not have a release date.  
You can try to use the legacy outline page and check the outline.  
To use legacy outline page, you can turn of the waffle flag contentstore.new\_studio\_mfe.use\_new\_course\_outline\_page in {LMS\_HOST}/admin/waffle/flag/

---

<div class="post-metadata">

**Author:** ![sbernesto](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/sbernesto/32/90_2.png) [@sbernesto](https://discuss.openedx.org/u/sbernesto)\
**Post date:** [May 23, 2025, 5:58pm UTC](https://discuss.openedx.org/t/attributeerror-nonetype-object-has-no-attribute-year/16009/3 "2025-05-23T17:58:51Z")

</div>

Hi,

Thanks, I’ll check it out, but in the meantime, I’ll share the script to solve it.

The script searches within blocks of the course where the date is not set and by default sets the date to January 2024.

```python
from xmodule.modulestore.django import modulestore
from opaque_keys.edx.locator import CourseLocator
from xmodule.modulestore.exceptions import ItemNotFoundError
from datetime import datetime
import pytz

store = modulestore()
course_key = CourseLocator.from_string("COURSE_ID")

try:
    course = store.get_course(course_key, revision='draft')
    print(f"Curso encontrado: {course.id}")
except ItemNotFoundError:
    print("Curso no encontrado. Verifica que exista en Studio.")
    exit()

updated_blocks = 0
default_start = datetime(2024, 1, 1, tzinfo=pytz.UTC)

def fix_block_start(block_key):
    global updated_blocks
    try:
        block = store.get_item(block_key, revision='rev-opt-draft-only')
        if getattr(block, 'start', None) is None:
            block.start = default_start
            store.update_item(block, None)
            updated_blocks += 1
            print(f"✅ Corregido: {block.location}")
        for child_key in block.children:
            fix_block_start(child_key)
    except Exception as e:
        print(f"Error con {block_key}: {e}")

fix_block_start(course.location)

print(f"\n✅ Total de bloques corregidos: {updated_blocks}")

```

Then we copy it into the container and run it.

```auto
docker cp fix_course_starts.py $(docker ps -qf "name=tutor_local-cms-1"):/openedx/edx-platform

python manage.py cms shell < fix_course_starts.py

```

---

<div class="post-metadata">

**Author:** ![sbernesto](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/sbernesto/32/90_2.png) [@sbernesto](https://discuss.openedx.org/u/sbernesto)\
**Post date:** [May 23, 2025, 6:04pm UTC](https://discuss.openedx.org/t/attributeerror-nonetype-object-has-no-attribute-year/16009/4 "2025-05-23T18:04:30Z")

</div>

Hi @Anh_Vu_Nguy_n ,

I’ve already tried disabling the flag, and the error persists.

I still appreciate you taking the time to help me. I already shared the script to resolve this issue in a previous post.
