I think it's because "pencil" is actually the subject of the sentence, but seems like the object because it is in passive voice in English: Literally, "By you is there a pencil?", which is "A pencil is by you?"
That's the only thing that makes sense to me, because all of the sentences in this format so far have had the thing "possessed" in the Nominative case.
It is «Разве у тебя нет карандаша?» Remember that negative questions are used in Russian for politeness when asking for information ("Do you happen to know...?") or for an object ("Maybe you have .... ?") If you are suprised that something is the case, even though you thought it wasn't, разве is used.
The exercise I did had me translating into English.
It's difficult to say if there is something wrong with your Russian sentence, since it's not in Russian. You should consider a change to a Russian keyboard, either physical or virtual. With Windows, it's easy to do. I think it's also easy with Apple products. What kind of device do you use to do Duo?