anchor.diff:              {error, Reason}
       end.
   
  +
  +-spec create_missing_parent(storage_file_ctx:ctx(), info()) ->
  +    {result(), file_ctx:ctx()} | {error, term()}.
  +create_missing_parent(StorageFileCtx, Info = #{parent_ctx := ParentCtx}) ->
  +    try
  +        create_missing_parent_unsafe(StorageFileCtx, Info)
  +    catch
  +        throw:?ENOENT ->
  +            cleanup_file(ParentCtx, StorageFileCtx),
  +            {error, ?ENOENT};
  +        Error:Reason ->
  +            FileName = storage_file_ctx:get_file_name_const(StorageFileCtx),
  +            SpaceId = storage_file_ctx:get_space_id_const(StorageFileCtx),
  +            StorageId = storage_file_ctx:get_storage_id_const(StorageFileCtx),
  +            ?error_stacktrace("importing file ~p on storage ~p in space ~p failed due to ~w:~w",
  +                [FileName, StorageId, SpaceId, Error, Reason]),
  +            cleanup_file(ParentCtx, StorageFileCtx),
  +            {error, Reason}
  +    end.
  +
  +
   -spec cleanup_file(file_ctx:ctx(), storage_file_ctx:ctx()) -> ok.
   cleanup_file(ParentCtx, StorageFileCtx) ->
       UserCtx = user_ctx:new(?ROOT_SESS_ID),
  
positive.code:             end
      end.
  
  
  %%--------------------------------------------------------------------
  %% @doc
  %% Updates mode, times, size, file_location and ACLs of already imported file.
  
negative.code:             case get_child_safe(ParentCtx, MissingParentName) of
                  {ok, MissingParentCtx} -> MissingParentCtx;
                  {error, ?ENOENT} ->
                      case create_missing_parent(MissingParentStorageCtx, Info) of
                          {?IMPORTED, MissingParentCtx} -> MissingParentCtx;
                          {error, ?ENOENT} -> undefined
                      end
              end
  