Crash when setting priority of a thread

If i try to set a thread’s priority with

t.set_priority(osPriorityAboveNormal);

it crashes with error

Error Status: 0x80010132 Code: 306 Module: 1
Error Message: Thread: 0x0, Parameter error

Do i need to do anything else before setting priority?

Has the thread been started yet? It looks like it may need to be running before you can call this.