TypeError: no implicit conversion of nil into String lib/gitlab/gfm/reference_rewriter.rb:64:in `+' new_text = before + cross_reference + after lib/gitlab/gfm/reference_rewriter.rb:64:in `unfold_reference' new_text = before + cross_reference + after lib/gitlab/gfm/reference_rewriter.rb:44:in `block in rewrite' unfold_reference(reference, Regexp.last_match, target_project) lib/gitlab/gfm/reference_rewriter.rb:43:in `gsub' @text.gsub(@pattern) do |reference| lib/gitlab/gfm/reference_rewriter.rb:43:in `rewrite' @text.gsub(@pattern) do |reference|...(166 additional frame(s) were not displayed)TypeError: no implicit conversion of nil into String
We are also seeing this on our self-hosted instance. We have a few issues in a project (that was changed from internal to private, although this is not necessarily related) that cannot be moved to another one.
This is the response from the server with details removed:
{"method":"PUT","path":"/<removed>/Overview/issues/3.json","format":"json","controller":"Projects::IssuesController","action":"update","status":500,"error":"TypeError: no implicit conversion of nil into String","duration":449.93,"view":0.0,"db":50.84,"time":"2017-09-15T08:10:07.585Z","params":{"title":"<removed>","confidential":false,"description":"<removed>","lockedWarningVisible":false,"move_to_project_id":115,"updateLoading":true,"namespace_id":"<removed>","project_id":"Overview","id":"3","issue":{"title":"<removed>","description":"<removed>","confidential":false}},"remote_ip":"<removed>","user_id":6,"username":"ossi"}
And the full stack trace
TypeError (no implicit conversion of nil into String): lib/gitlab/gfm/reference_rewriter.rb:64:in `+' lib/gitlab/gfm/reference_rewriter.rb:64:in `unfold_reference' lib/gitlab/gfm/reference_rewriter.rb:44:in `block in rewrite' lib/gitlab/gfm/reference_rewriter.rb:43:in `gsub' lib/gitlab/gfm/reference_rewriter.rb:43:in `rewrite' app/services/issues/move_service.rb:106:in `block in rewrite_content' app/services/issues/move_service.rb:104:in `each' app/services/issues/move_service.rb:104:in `inject' app/services/issues/move_service.rb:104:in `rewrite_content' app/services/issues/move_service.rb:82:in `block in rewrite_notes' app/services/issues/move_service.rb:79:in `rewrite_notes' app/services/issues/move_service.rb:26:in `block in execute' app/services/issues/move_service.rb:21:in `execute' app/controllers/projects/issues_controller.rb:136:in `update' lib/gitlab/i18n.rb:46:in `with_locale' lib/gitlab/i18n.rb:52:in `with_user_locale' app/controllers/application_controller.rb:326:in `set_locale' lib/gitlab/middleware/multipart.rb:93:in `call' lib/gitlab/request_profiler/middleware.rb:14:in `call' lib/gitlab/middleware/go.rb:17:in `call' lib/gitlab/etag_caching/middleware.rb:11:in `call' lib/gitlab/request_context.rb:18:in `call' lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
@ossiv Can you share what referables do you have mentioned in the issue that causes problems when moving? Do you have a group milestone there, referenced by a ID?
I would like to fix that, but I'm not sure what are the business rules behind these changes.
What happens if someone moves an issue to a different project within the same group? How should we rewrite a group milestone reference? Currently it raises an error, because default milestone format is :iid, but you can't refer to a group milestone by it. We probably should not rewrite the reference at all.
What happens if someone moves an issue with a group milestone reference to a project inside a different group? Should we rewrite the reference? I guess that we should not.
I just opened a merge request, which for now only contains a test that makes this problem reproducible. Waiting for Sean's and Felipe's answers, to decide on how to fix this problem.
Thank you @grzesiek for digging into this problem.
What happens if someone moves an issue to a different project within the same group? How should we rewrite a group milestone reference? Currently it raises an error, because default milestone format is :iid, but you can't refer to a group milestone by it. We probably should not rewrite the reference at all.
If you move an issue from one project to another project within the same group, and the original issue had a group milestone, than the new issue should have the same group milestone.
What happens if someone moves an issue with a group milestone reference to a project inside a different group? Should we rewrite the reference? I guess that we should not.
In this case, look at the new project's group. If that group has a group milestone with the same name as the previous one, then use that. Otherwise, don't have a milestone.
What is still not clear for me, from mostly the technical point of view, is why do we forbid to reference a group milestone by an internal ID number, do you maybe know @victorwu?
@grzesiek : That level of technical detail I don't know what it was chosen that way. Sean is out currently. Let's wait for @felipe_artur to respond. Thanks!
I first added that line because in the first iteration we did not support references for group milestones.
I think @smcgivern decided to let the reference be made by name because Group and Projects milestones names are unique in group scope.
If we need to use iid there is no problem to change, but group and project milestones are in different tables so we will have duplicated iids which is not ideal. I suggest keep using names.