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

Initial sync: Error creating Monica contact: ['The selected gender id is invalid.'] #22

Closed
Turochamp opened this issue Jul 27, 2021 · 4 comments · Fixed by #24
Closed
Assignees
Labels
bug Something isn't working

Comments

@Turochamp
Copy link
Contributor

Turochamp commented Jul 27, 2021

Got this error when doing initial sync. In Google Contacts this entry does not have a gender entered. So don't understand why it's not valid. Is it general or specific to my Monica instance?

2021-07-27 11:13:08,642 INFO 'Petur V-son': Error creating Monica contact: ['The selected gender id is invalid.']
2021-07-27 11:13:08,643 ERROR Error creating Monica contact!
Traceback (most recent call last):
  File "GMSync.py", line 77, in main
    sync.startSync('initial')
  File "/home/mahs/git/GoogleMonicaSync/SyncHelper.py", line 44, in startSync
    self.__initialSync()
  File "/home/mahs/git/GoogleMonicaSync/SyncHelper.py", line 81, in __initialSync
    self.__buildSyncDatabase()
  File "/home/mahs/git/GoogleMonicaSync/SyncHelper.py", line 564, in __buildSyncDatabase
    monicaId = self.__interactiveMonicaIdSearch(googleContact)
  File "/home/mahs/git/GoogleMonicaSync/SyncHelper.py", line 1045, in __interactiveMonicaIdSearch
    monicaContact = self.__createMonicaContact(googleContact)
  File "/home/mahs/git/GoogleMonicaSync/SyncHelper.py", line 985, in __createMonicaContact
    monicaContact = self.monica.createContact(data=form.data)
  File "/home/mahs/git/GoogleMonicaSync/MonicaHelper.py", line 126, in createContact
    raise Exception("Error creating Monica contact!")
Exception: Error creating Monica contact!
@antonplagemann
Copy link
Owner

antonplagemann commented Jul 28, 2021

Hi @Turochamp,
I'm not sure on this...
The script uses the default gender types, which could have changed at your instance.
Can you send the gender types you have?
Simply log into your instance and head to https://your-monica-instance.com/api/genders and paste the output here.
That might help diagnosing this 😊

@Turochamp
Copy link
Contributor Author

Turochamp commented Jul 29, 2021

Hi @antonplagemann,

Below is the response output. Further testing shows that every time the sync tries to create a Monica contact result is this error.

{
    "data": [
        {
            "id": 71764,
            "object": "gender",
            "name": "Man",
            "type": "M",
            "account": {
                "id": 24528
            },
            "created_at": "2020-10-12T20:03:02Z",
            "updated_at": "2020-10-12T20:03:02Z"
        },
        {
            "id": 71765,
            "object": "gender",
            "name": "Woman",
            "type": "F",
            "account": {
                "id": 24528
            },
            "created_at": "2020-10-12T20:03:02Z",
            "updated_at": "2020-10-12T20:03:02Z"
        },
        {
            "id": 71766,
            "object": "gender",
            "name": "Rather not say",
            "type": "O",
            "account": {
                "id": 24528
            },
            "created_at": "2020-10-12T20:03:02Z",
            "updated_at": "2020-10-12T20:03:02Z"
        }
    ],
    "links": {
        "first": "http://my-monica-instance/api/genders?page=1",
        "last": "http://my-monica-instance/api/genders?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "links": [
            {
                "url": null,
                "label": "❮ Previous",
                "active": false
            },
            {
                "url": "http://my-monica-instance/api/genders?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Next ❯",
                "active": false
            }
        ],
        "path": "http://my-monica-instance/api/genders",
        "per_page": 15,
        "to": 3,
        "total": 3
    }
}

@antonplagemann
Copy link
Owner

antonplagemann commented Jul 29, 2021

Ok thanks, got it 👍
I was using static values for the id as in my instance they are just 1, 2 and 3 but for your instance they start at 71764 😅
Another case of assuming wrong things 😊
With 695c03e the ids are now dynamically fetched from the instance, that should fix it.
Would be great if you can confirm this 🙂

@Turochamp
Copy link
Contributor Author

Tested and confirmed. 😆

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

Successfully merging a pull request may close this issue.

2 participants